How to solve "too many root tiles" error?

819
4
Jump to solution
01-20-2020 03:41 AM
ae
by
Occasional Contributor II

Hi, 

I have an application where I would like to use a WebTileLayer as the basemap. The layer has a spatialreference with wkid 25833 (utm33). I have managed to get the layer to work in the MapView, but it does not work in the SceneView, due to it breaking the rule that the layer cannot have more than 30 tiles on the root level (level 0). 

Here is my definition of the layer from by source code: 

let mapBaseLayer = new WebTileLayer({
          urlTemplate: "https://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=matrikkel_bakgrunn2&style=default&tilematrixset=EPSG:25833&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&TileMatrix=EPSG:25833:{level}&TILEROW={row}&TILECOL={col}",
          subDomains: ["opencache", "opencache2", "opencache3"],
          spatialReference: { wkid: 25833 },
          tileInfo: {
            size: 256,
            dpi: 96,
            format: "PNG",
            origin: {
              x: -2500000,
              y: 9045984
            },
            spatialReference: {
              wkid: 25833,
              latestWkid: 25833
            },
            lods: [
              {
                level: 0,
                resolution: 21664,
                scale: 81920000
              },
              {
                level: 1,
                resolution: 10832,
                scale: 40960000
              },
              {
                level: 2,
                resolution: 5416,
                scale: 20480000
              },
              {
                level: 3,
                resolution: 2708,
                scale: 10240000
              },
              {
                level: 4,
                resolution: 1354,
                scale: 5120000
              },
              {
                level: 5,
                resolution: 677,
                scale: 2560000
              },
              {
                level: 6,
                resolution: 338.5,
                scale: 1280000
              },
              {
                level: 7,
                resolution: 169.25,
                scale: 640000
              },
              {
                level: 8,
                resolution: 84.625,
                scale: 320000
              },
              {
                level: 9,
                resolution: 42.3125,
                scale: 160000
              },
              {
                level: 10,
                resolution: 21.15625,
                scale: 80000
              },
              {
                level: 11,
                resolution: 10.578125,
                scale: 40000
              },
              {
                level: 12,
                resolution: 5.2890625,
                scale: 20000
              },
              {
                level: 13,
                resolution: 2.64453125,
                scale: 10000
              },
              {
                level: 14,
                resolution: 1.322265625,
                scale: 5000
              },
              {
                level: 15,
                resolution: 0.6611328125,
                scale: 2500
              },
              {
                level: 16,
                resolution: 0.33056640625,
                scale: 1250
              },
              {
                level: 17,
                resolution: 0.165283203125,
                scale: 625
              }
            ]
          }
        });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I'm wondering: Is there anything I can do on the client side to make this work, or is this simply a problem of the service that I'm using, making it impossible to use this layer in a sceneview?

Also, I'm thinking that maybe my tileInfo settings are incorrect. I've set it up according to the documentation of the service but maybe I've misunderstood some aspects. Does my tileInfo look correct? 

0 Kudos
1 Solution

Accepted Solutions
RalucaNicola1
Esri Contributor

Ok, it seems the error is that you need to set the fullExtent also on the layer, so that the engine knows where to calculate the tiles from. Here is a working sample.

That error with too many tiles wasn't very helpful, I'll open up an issue to have a more appropriate error.

View solution in original post

0 Kudos
4 Replies
RalucaNicola1
Esri Contributor

Unfortunately there is no client-side hack around this. The limitations are also described in the TileLayer documentation. Otherwise the tiling scheme looks good to me. Let me know if you run into other issues.

0 Kudos
ae
by
Occasional Contributor II

Thanks for your reply Raluca. 

I've tried to determine how many tiles there are on the root level for the service I'm using, and as far as I can see, there is only one tile there: 

https://opencache.statkart.no/gatekeeper/gk/gk.open_wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&... 

Is there still any reason I could get this error? 

I have created a jsfiddle to illustrate the problem: https://jsfiddle.net/xu08kh1e/ 

You wont see any map loading due to the error, but if you check the console and dig into the details of the error you'll see the error "tilingscheme:too-many-root-tiles". 

0 Kudos
RalucaNicola1
Esri Contributor

Ok, it seems the error is that you need to set the fullExtent also on the layer, so that the engine knows where to calculate the tiles from. Here is a working sample.

That error with too many tiles wasn't very helpful, I'll open up an issue to have a more appropriate error.

0 Kudos
ae
by
Occasional Contributor II

That's great Raluca! Many thanks for your help!

0 Kudos