Can't load WMTS Layer

2305
3
06-15-2022 06:31 AM
FranAcuñaParra
New Contributor II

Hello team,

I'm trying to load a simple WMTS Layer in my map. The version of the ESRI Android SDK that I use is 100.3 and I have not been able to load the WMTS Layer. I've followed the instructions of the API documentation for version 100.3 (I've downloaded it). Any help would be very appreciated. Below you will find the code:

 

 

 

mapa = getView().findViewById(R.id.mapView);
ArcGISMap map = new ArcGISMap();
mapa.setMap(map);

WmtsLayer wmtsLayer = new WmtsLayer("https://www.ign.es/wmts/mapa-raster", "MTN");
//wmtsLayer.loadAsync();
//final WmtsLayer wmtsLayer = new WmtsLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS?", "WorldTimeZones");
wmtsLayer.addDoneLoadingListener(new Runnable() {
    public void run() {
        if (wmtsLayer.getLoadStatus() == LoadStatus.LOADED) {
            Basemap baseMap = new Basemap(wmtsLayer);
            map.setBasemap(baseMap);
            Log.d("Capa WMTS: ", map.getLoadStatus().toString());
        }
    }
});

 

 

 

Thanks in advance. 

0 Kudos
3 Replies
MatveiStefarov
Esri Contributor

Hello Francisco,

I was able to reproduce this error with Runtime 100.3 and even with the latest update (100.14.1). I see that this WMTS layer fails to load with "Invalid argument: tile info origin must have a spatial reference."

I am not sure about the cause yet.  I will continue investigating this problem, and I will let you know if I have any updates or if I find a workaround.

0 Kudos
FranAcuñaParra
New Contributor II

Hello @MatveiStefarov ,

Thanks for your reply. If you can let me know any updates or workaround, it would be great. On the other hand, I can load the WMTS Layer  with the URL and the name provided above in the code with the ArcGIS API Javascript in another project without any problem, just if it helps.

 

Thank you 

0 Kudos
MatveiStefarov
Esri Contributor

Hello again! I have some updates.

The reason Runtime had trouble loading this service is: this service specifies SupportedCRS of the default tile matrix set ("InspireCRS84Quad") in an unusual way. It is declared as http://www.opengis.net/def/crs/OGC/1.3/CRS84 instead of the usual CRS84 or CRS:84 or urn:ogc:def:crs:OGC:1.3:CRS84 formats. I've only seen this pattern on newer OGC-API-Features services before, never on WMTS. Future versions of Runtime should be able to parse this rare format too.

The workaround is to use a WMTSLayer constructor that takes a TileMatrixName. Other tile matrix sets on this service do not have the same problem.  For example, you can use "GoogleMapsCompatible" in a WebMercator map (it looks best) or "EPSG:4326" in a WGS84/Plate Carree map.  I was able to get this service working with Runtime 100.14.1 in both SceneView and MapView:

2022-07-06_100710.jpg

Please let me know if this solves your problem!

0 Kudos