Hi, I have MapView with basemap (wkid 5514). When I add this specific WMTS layer : https://services.sentinel-hub.com/ogc/wmts/9c4df810-8939-4ef5-9962-fd51bf66ece8
it is rendered on wrong place, it is moved hundreds kilometers to north.
The same behaviour can be simulated on online arcgis map viewer, when setting this wmts as basemap first :
https://zbgisws.skgeodesy.sk/zbgis_ortofoto_wmts/service.svc/get
Problem is with the sentinel layer and tileMatrixSet used : CZE, which supports urn:ogc:def:crs:EPSG::5514, but its tile sizes height != width :
<TileWidth>512</TileWidth>
<TileHeight>286</TileHeight>
I can fix this problem only in ArcGis online viewer using another tileMatrixSetId : UTM33N, which could be acceptable.
But I'm not able to set this tileMatrixSet when creating WMTSLayer :
let tileMatrixSet = 'UTM33N';
let wmtsOptions = {
id:'my-internal-id',
url: 'https://services.sentinel-hub.com/ogc/wmts/9c4df810-8939-4ef5-9962-fd51bf66ece8',
spatialReference: this.mapView.spatialReference,
};
wmtsOptions['activeLayer'] = {id: parameters.activeLayer};
wmtsOptions['tileMatrixSetId'] = tileMatrixSet;
wmtsOptions['tileMatrixSet'] = tileMatrixSet;
let lyr = new WMTSLayer(wmtsOptions);
I tried to set tileMatrixSetId for sublayers too :
lyr.load().then(() => {
let sublayers = (lyr as WMTSLayer).sublayers;
let activeLayer = (lyr as any).activeLayer;
activeLayer.tileMatrixSetId = tileMatrixSet;
if(sublayers?.length){
sublayers.forEach(sublayer => {
sublayer.tileMatrixSetId = tileMatrixSet;
});
}
lyr.load().then(() => {
console.log('reloaded lyr: ', lyr);
});
});
I can see in console, that tileMatrixSetId is set to UTM33N, bet the request sent by browser have still TILEMATRIXSET=CZE.
How can I specify the the tileMatrixSet for WMTS layer ?
If all you're trying to do is replace TILEMATRIXSET=CZE with TILEMATRIXSET=UTM33N in the request URLs, you can do that fairly easily with a RequesInterceptor:
esriConfig.request.interceptors.push({
urls: ["https://services.sentinel-hub.com/ogc/wmts/9c4df810-8939-4ef5-9962-fd51bf66ece8"],
before: function(params) {
var index1 = params.url.indexOf("TILEMATRIXSET=");
if (index1 > 0) {
var url = params.url.substring(0, index1) + "TILEMATRIXSET=UTM33N";
var index2 = params.url.indexOf("&", index1);
if (index2 > index1)
url += params.url.substr(index2);
params.url = url;
}
return null;
}
});
Hi, thank for your feedback. This seems to be a "extremelly hot" fix, because - in this case I should probably change TILEMATRIX, TILEROW and TILECOL too. This is something that esri object should calculate.
I hope there is standard way to specify tileMatrixSet, because when using Online ArcGisMap Viewer I have to select the TileMatrixSet to use before the layer is added to map.