Use of lower level tile when higher level is not available ?

Hi,
From the following code, we can see that if someone zoom out, the image disappear.
This is because the WMTS server is not serving tiles for these levels.
Would it be possible to configure the layer to use lower level tiles when higher level tiles are not available ?

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’,
});
widget.imageryLayers.addImageryProvider(landsat);

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

Thanks!

Hello,

I don’t think there is a way to do this automatically. You can try using the minimumLevel option if you know tiles only exist below a certain level. You need to be careful setting this number too high though because Cesium will try to load every tile from that level if your application is zoomed out all the way.

You can use that in conjunction with the rectangle option if you know the tiles only exist within a certain extent.

See the documentation for WebMapTileServiceImageryProvider

Best,

Hannah

Thank you for your answer,

minimumLevel and rectangle option of the layer seem to be what I'm looking for, but it actually throws an error with WebMapTileServiceImageryProvider saying:
"The imagery provider's rectangle and minimumLevel indicate that there are 16 tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported."

With WebMapServiceImageryProvider I can get it working with these options but I need to use WMTS...

Do you know what can I do to have the same behavior with WebMapTileServiceImageryProvider ?

Thanks!

Hmm, sorry I wasn’t aware that was a restriction for our WMTS provider. That doesn’t seem to be in place for our other imagery providers. I’ve written up an issue to find out if we can get rid of this check or raise the threshold: https://github.com/AnalyticalGraphicsInc/cesium/issues/4372

In the mean time, you can edit the code to adjust the tile count threshold. Here’s the code you would need to change: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/WebMapTileServiceImageryProvider.js#L142-L144

For instructions on checking out and building the code base, see our contributors documentation: https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors/BuildGuide

Best,

Hannah

Thanks Hannah, I tried to comment those lines but unfortunately I stumbled upon something else after doing so :
"TypeError: Cannot read property 'south' of undefined"
from ImageryLayer._createTileImagerySkeletons (http://cesiumjs.org/Cesium/Source/Scene/ImageryLayer.js:562:62)

It does not seem to be specific to WebMapTileServiceImageryProvider but more dependent of the rectangle,
this sandcastle code can reproduce the error with a WebMapServiceImageryProvider :
var widget = new Cesium.CesiumWidget(‘cesiumContainer’);
var provider = new Cesium.WebMapServiceImageryProvider({
    url : ’ http://ows.terrestris.de/osm/service?’,
    layers : ‘OSM-WMS’,
    rectangle : Cesium.Rectangle.fromDegrees(149.0625, -36.5625, 154.6875, -30.9375),
    minimumLevel : 6,
});
widget.imageryLayers.addImageryProvider(provider);

depending on the rectangle, I also get other similar errors :
"TypeError: Cannot read property 'east' of undefined"
from ImageryLayer._createTileImagerySkeletons (http://cesiumjs.org/Cesium/Source/Scene/ImageryLayer.js:545:58)

For now I decided to stay with the current limitation of maximum 4 tiles at minimum level and modified my WMTS server to produce more levels on the fly but I'd prefer to disable this as soon as we find a solution.

Thank you again for your time!

Thanks for sending over the code example! I’m not too familiar with how this works, so I’m not sure if it’s a bug in Cesium or a problem with using the imagery provider options incorrectly. Regardless, I filed an issue report on our GitHub so we can look into it further: https://github.com/AnalyticalGraphicsInc/cesium/issues/4377
Glad you were able to find a workaround in the meantime

Best,

Hannah