使用Android Runtime API 100.2.0,我想添加一个WMTS图层作为底图。不幸的是,图层没有显示在地图中。 WMTS服务网址为https://geodata.nationaalgeoregister.nl/tiles/service/wmts?request=getcapabilities。它似乎只能在Key Value Pairs(KVP)编码中使用。这个WMTS服务中的一个层是我想用作底图的一个层:“top100raster”。空间参考是Amersfoort / RD New:EPSG Projection - Spatial Reference(http://spatialreference.org/ref/epsg/amersfoort-rd-new/)。
活动代码:
private SpatialReference spatialReference = SpatialReference.create(28992);
private double[] bbox = new double[]{646.36, 308975.28, 276050.82, 636456.31};
mapView = (MapView) findViewById(R.id.map);
mapView.setViewpoint(new Viewpoint(new Envelope(bbox[0], bbox[1], bbox[2], bbox[3], spatialReference)));
ArcGISMap map = new ArcGISMap(spatialReference);
mapView.setMap(map);
WmtsLayer wmtsLayer = new WmtsLayer("https://geodata.nationaalgeoregister.nl/tiles/service/wmts?", "top100raster"));
Basemap baseMap = new Basemap(wmtsLayer);
map.setBasemap(baseMap);
项目中没有错误,编译和运行也没有错误。然而地图是空的: - (
我在这里缺少什么?
答案 0 :(得分:0)
问题解决了...下面的修改后的代码可以使用。
private SpatialReference spatialReference = SpatialReference.create(28992);
private double[] bbox = new double[]{646.36, 308975.28, 276050.82, 636456.31};
mapView = (MapView) findViewById(R.id.map);
ArcGISMap map = new ArcGISMap(spatialReference);
map.setInitialViewpoint(new Viewpoint(new Envelope(bbox[0], bbox[1], bbox[2], bbox[3], spatialReference)));
WmtsLayer wmtsLayer = new WmtsLayer("https://geodata.nationaalgeoregister.nl/tiles/service/wmts?request=GetCapabilities&service=WMTS", "top100raster");
Basemap baseMap = new Basemap(wmtsLayer);
map.setBasemap(baseMap);
mapView.setMap(map);