cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Raise WMTS imagery provider tile count threshold

Open hpinkos opened this issue 9 years ago • 2 comments

Related to this forum post: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/wMdmusP1Fu4

The user has encountered this developer error which is thrown when the tile count is more than 4 at the minimum level. Our other imagery providers don't seem to have this restriction.

I understand why this restriction is there so it will prevent the user from trying to load in an entire globe worth of tiles at a higher level, but in this case the user has only 16 tiles within the imagery provider rectangle, and it doesn't seem like that should be restricted.

Can we get rid of this developer error? Or is there any reason why the max tile count number shouldn't be a little higher?

hpinkos avatar Sep 27 '16 14:09 hpinkos

This is a very old ticket, but I was able to recreate the first code snippet from the google forum link, which uses maps.ypeka.gr. In my sandbox, I am getting the developer error.

Here's the snippet I used, altering it to recreate the second snippet's minimumLevel issue:

var widget = new Cesium.CesiumWidget('cesiumContainer');

var landsat = new Cesium.WebMapTileServiceImageryProvider({
  url : 'http://maps.ypeka.gr/arcgis/rest/services/YPEKA/LandSat/MapServer/WMTS',
  layer : 'YPEKA_LandSat ',
  style : 'default',
  format : 'image/jpeg',
  tileMatrixSetID : 'default028mm',
  minimumLevel: 2, // Adding this at a value >=2 causes the error
});
widget.imageryLayers.addImageryProvider(landsat);

widget.camera.setView({
  destination: Cesium.Rectangle.fromDegrees(18, 33, 30, 43)
});

As a newbie to Cesium contributions, I am not sure what to do to resolve this ticket. Should I remove the developer error block of code*? Or should I add a threshold (and if so, what's the threshold)?

* The block in question /* file: packages\engine\Source\Scene\WebMapTileServiceImageryProvider.js */ // Check the number of tiles at the minimum level. If it's more than four, // throw an exception, because starting at the higher minimum // level will cause too many tiles to be downloaded and rendered. const swTile = this._tilingScheme.positionToTileXY( Rectangle.southwest(this._rectangle), this._minimumLevel, ); const neTile = this._tilingScheme.positionToTileXY( Rectangle.northeast(this._rectangle), this._minimumLevel, ); const tileCount = (Math.abs(neTile.x - swTile.x) + 1) * (Math.abs(neTile.y - swTile.y) + 1); //>>includeStart('debug', pragmas.debug); if (tileCount > 4) { throw new DeveloperError( `The imagery provider's rectangle and minimumLevel indicate that there are ${tileCount} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`, ); } //>>includeEnd('debug');

Thanks :)

adamwirth avatar Mar 18 '25 16:03 adamwirth

Thanks for looking into this @adamwirth! Yes, the fix here should be to remove the DeveloperError code block, from //>>includeStart('debug', pragmas.debug); to //>>includeEnd('debug');.

ggetz avatar Jun 09 '25 20:06 ggetz