imageryProvider/ ImageryLayer redraw tiles

Hi,

Is there any functions such as redraw or refresh that when we change imageryProvider’s settings it redraws tiles on the globe? I searched the api for these objects but could not find any functions.

2 Likes

Can you describe your use case here? If you have tiles that update over time using a time dynamic imagery provider is probably the best solution: https://sandcastle.cesium.com/index.html?src=Web%20Map%20Tile%20Service%20with%20Time.html

Otherwise, you could remove and re-add the imagery provider.

Hi,
In my case the tile’s style changes by a parameter in the url. so when user changes that parameter layer must be loaded again. in the leaflet there is a function named redraw which draws all the tiles of a layer from scratch. I was wondering if there is something similar in cesium as well.

What type of imagery provider are you using? If it’s something like the UrlTemplateImageryProvider, where the URL is readonly, I think recreating the provider would be the right way to go.

I am using a kind of customized imageryProvider based on this sourcecode
https://github.com/TerriaJS/terriajs/blob/master/lib/Map/MapboxVectorTileImageryProvider.js

I have two options. either change the url or change the stylefunction. I think they both will effect the newly loaded tiles but I think there must be a way to re render the already downloaded tiles as well otherwise there will be a miss match between the already loaded tiles and new tiles.

I am running into this issue too, in a very similar context. I am using an ImageryProvider to render vector tiles provided by a webgl context, and occasionally need to change the style to re-filter the dataset. I basically need a “refresh” method that requests the same tiles that are currently displayed and swaps them. I could reload the layer, potentially, but this does not seem like a very clean solution.

It looks like there is similar logic in the WebMapTileServiceImageryProvider, dealing with “time dynamic” layers, but I’m not sure how to wire that up in this case.

1 Like

Following your lead on WebMapTileServiceImageryProvider I dug into the code and found that the base class of ImageryProviders has an internal method called _reload() that does just that - requests all the tiles that are displayed again. Obviously I don’t like using internal methods, but I’ve been using it and it seems to do what I needed it to do.

2 Likes