amo*_*rao 5 android wms mapbox
目前我正在开发在原生android平台的地图上添加WMS源.我正在使用mapbox在应用程序中显示地图.我正在尝试从Geo-server添加WMS源图层但是WMS源图层会在地图上多次添加,如图所示:
这是我用来添加WMS源代码片段:
@Override public void onMapReady(MapboxMap mapboxMap){
RasterSource webMapSource = new RasterSource(
"web-map-source",
new TileSet("tileset", "http://geo.skymetweather.com:8081/geoserver/cite/wms/cite:india_district_web?" +
"&bbox=68.036003112793,6.60812377929688,97.5504302978516," +
"37.2502937316895&format=image/png&service=WMS&version=1.1.1&" +
"request=GetMap&srs=EPSG:4326&width=493&height=512&layers=cite:india_district_web"), 256);
mapboxMap.addSource(webMapSource);
// Add the web map source to the map.
RasterLayer webMapLayer = new RasterLayer("web-map-layer", "web-map-source");
mapboxMap.addLayerBelow(webMapLayer, "aeroway-taxiway");
}
Run Code Online (Sandbox Code Playgroud)
如果代码有任何问题或有人知道如何在地图上添加Raster Source,请建议吗?
提前致谢 !
Mapbox 仅支持“EPSG:3857”来渲染 WMS 图块,您应该将源投影到此 SRS。此外,无需像在 TileSet 的第二行中那样静态设置其边界框。使用此模板在您的应用程序中加载 WMS:
RasterSource webMapSource = new RasterSource(
"web-map-source",
new TileSet("tileset",
'http://a.example.com/wms?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&width=256&height=256&layers=example')
,256);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
455 次 |
| 最近记录: |