default value for maximumLevel in Cesium.TileMapServiceImageryProvider

In the doc it is mentioned that the default value for "maximumLevel" is 18 but in TileMapServiceImageryProvider.js it says that the default value is 10

that._maximumLevel = defaultValue(description.maximumLevel, parseInt(tilesets[tilesets.length - 1].getAttribute('order'), 10));

I tried running my without explicitly defining maximumLevel. In chromes console, it shows 404 for images with <url>/8/* and there were no requests sent for images in folders greater than <url>/8/* which means the default value is 8. Can anyone look into it?


That 10 is a parameter to parseInt, indicating that the number should be parsed as base 10. If the tilemapresource.xml does not specify an “order”, I believe the maximum level will be undefined, indicating that there is no maximum. If there is no tilemapresource.xml, the maximum level is 18 as specified in the documentation.

However, Cesium will not request any child tiles for any tile that fails. So if level 8 returns 404s, none of that tile’s level 9 tiles will not be requested, no matter the value of the maximum level.


I totally failed at that last sentence. It should say:

So if a level 8 tile returns 404 (or any error), none of that tile’s level 9 child tiles will be requested.

Oh sorry! my bad! I did not read the doc for parseInt properly and you are right I have specified maximumlevel as 8 in tilemapresources, but I only have upto level3 images in the folder, any request for level4 tiles will give 404 but it is sending requests for tiles in up to level8.

You’re right, it seems that Cesium will keep requesting tiles up to the maximum level, even if an intermediate level fails, contrary to what I said before. I’m not sure if I consider that a bug or not. Other than causing some spam in the console, I think it’s ok.

This brings up an interesting point. Since Cesium does in fact keep requesting child tiles whether the parent exists or not, how difficult would it be to introduce a “minimumLevel”? My tile sets span 6-16 and I have no problem rendering them other than the wasted bandwidth and time requesting zoom levels 0-5. Would terrain rendering break?


I was just thinking about that as well. I’m assuming your first level (level 6) has just a small number of tiles, right? Like 1-4? In that case, it would be an easy change and would break almost nothing.

We should probably also add code to enforce that, though. For example, if you added a layer with global extent, with a minimum level of 6, Cesium would try to attach a very large number of imagery tiles to a single terrain and probably fail spectacularly. This would be true even if only a few of the level 6 tiles actually existed, because it would still try to request all the others. So the rule should be this: the number of tiles at the provider’s minimum level that overlap the provider’s extent must be less than or equal to four. A little higher than 4 might be ok.