WMTS layer not showing

945
1
02-09-2018 12:53 AM
Hermanvan_der_Maas
New Contributor

Using the Android Runtime API 100.2.0, I would like to add a WMTS layer as a basemap. Unfortunately the layer is not showing in the map. The WMTS service url is https://geodata.nationaalgeoregister.nl/tiles/service/wmts?request=getcapabilities. It seems to be available in Key Value Pairs (KVP) encoding only. One of the layers in this WMTS service is the one I would like to use as a basemap: "top100raster". The spatial reference is Amersfoort / RD New: EPSG Projection -- Spatial Reference.

Activity code:

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);

There are no errors in the project, also it compiles and runs without errors. The map however is empty 😞
What am I missing here?

1 Reply
Hermanvan_der_Maas
New Contributor

Problem solved... the modified code below works.

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);