View.zoom stuck on -1 for WMTS layer on API 4.22

680
5
Jump to solution
01-12-2022 05:12 AM
JanHellenberg
New Contributor II

Recently updated API version from 4.19 to 4.22 and as a result, my WMTS-layer zoom-property is stuck on -1 which of course has other consequences.  This has been working fine for a long time with both 4.16 and 4.19. If I go back to 4.19 it starts working again. The code is pretty straightforward and I can see no changes in the documentation that would affect this. JS console says nothing.

const MyLayer = new WMTSLayer({
   url: 'MyURL',
   activeLayer: {
      id: 'LayerId',
      tileMatrixSetId: '3857',
   },
})
 
const map = new Map({
   layers: [MyLayer],
   spatialReference: {
      wkid: 3857,
   },
})
 
const view = new MapView({
   container: 'viewDiv',
   map: map,
   spatialReference:
      wkid: 3857,
   },
})
 
So, what is going on here? Why are the zoom levels missing from my WMTS-layer in 4.22 but not 4.19?
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

Can you please try setting MapView.constraints.lods  by calling TileInfo.create() method in your app? I tested this and it works. Also, I noticed that it does not work for me in 4.19. In any case, we will create an issue on our side to set the MapView's tileInfo when wmtslayer is added. 

Please check out this test app to see how to set the MapView's tileInfo and how this sets the zoom levels accordingly. In the test app, I am setting the LODs to ArcGIS online tiling info. It is documented in TileInfo.create doc referenced above. 

 

 

View solution in original post

5 Replies
ReneRubalcava
Frequent Contributor

Can you provide a service URL to testify against? Not seeing this behavior with current ones used in samples, could be something in how the capabilities are parsed for some services.

0 Kudos
JanHellenberg
New Contributor II

My URL is with key authorization but actually I AM seeing the same problem in this sample:

https://developers.arcgis.com/javascript/latest/sample-code/layers-wmts/

Adding the following after view.when will show view.zoom=-1 and no effectiveLODs.

view.watch('scale', function (newScale) {
   console.log('Scale: ', view.scale)
   console.log('Zoom: ', view.zoom)
   console.log('Resolution: ', view.resolution)
   console.log('Effective LODS: ', view.constraints.effectiveLODs)
})

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

Can you please try setting MapView.constraints.lods  by calling TileInfo.create() method in your app? I tested this and it works. Also, I noticed that it does not work for me in 4.19. In any case, we will create an issue on our side to set the MapView's tileInfo when wmtslayer is added. 

Please check out this test app to see how to set the MapView's tileInfo and how this sets the zoom levels accordingly. In the test app, I am setting the LODs to ArcGIS online tiling info. It is documented in TileInfo.create doc referenced above. 

 

 

JanHellenberg
New Contributor II

Thank you, it worked great!

0 Kudos
JanHellenberg
New Contributor II

I just want to add that after adding the Tileinfo.create() I have the exact same issue as another user regarding the zoom property in Mapview that is reported in "Issue with 4.22 and zoom property". There is definitely something fishy going on with zoom/LODs for some layers in 4.22...

0 Kudos