0

我是 OpenLayers 和 GeoServer 新手,非常感谢任何帮助!

我正在使用Bing 地图示例中的代码加载基本地图。

final String key = "Apd8EWF9Ls5tXmyHr22OuL1ay4HRJtI4JG4jgluTDVaJdUXZV6lpSBpX-TwnoRDG";
// Bing key
Bing road = new Bing(new BingOptions("Road Layer", key, BingType.ROAD));
Bing hybrid = new Bing(new BingOptions("Hybrid Layer", key,
                BingType.HYBRID));
Bing aerial = new Bing(new BingOptions("Aerial Layer", key,
                BingType.AERIAL));
// And add them to the map
map.addLayer(road);
map.addLayer(hybrid);
map.addLayer(aerial);

然后我使用从其他一些示例中得出的这段代码加载我的 WMS 层。

WMSParams wmsParams = new WMSParams();
wmsParams.setFormat("image/png");
wmsParams.setLayers("test:myraster");
wmsParams.setStyles("");

WMSOptions wmsLayerParams = new WMSOptions();
wmsLayerParams.setIsBaseLayer(false);
wmsLayerParams.setAlwaysInRange(true);
wmsLayerParams.setUntiled();
wmsLayerParams.setWrapDateLine(true);

String wmsUrl = "http://localhost:8080/geoserver/wms";

WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);
map.addLayer(wmsLayer);

我在地图上也有图层切换器控件,因此我可以切换图层。

LayerSwitcher layerSwitcher = new LayerSwitcher();
map.addControl(layerSwitcher);

当我的地图加载时,我看到 bing 地图是图层切换器中的基础图层,而我的 wms 图层是覆盖图层。问题是当我的 wms 层可见时,我看不到基础层。我试图通过 wms 层显示的栅格只有 10 度乘 10 度,似乎所有其他空间都被白色填充,而不是让我看到下面的基础层。当我关闭我的 wms 层时,我可以看到基础层。

有没有人有什么建议?

4

0 回答 0