I am implementing a time based mvt service with data from different time periods and the possibility to navigate through that data. Based on the year the tile server sends an mvt of that specific timeframe and a coherent styling gives the visualization. I would need to be able to update the data (invalidate and reload) in the viewport without resetting the style (and as such avoiding the flicker effect) considering the changing date and not only the changing coordinates.
https://map.openhistorymap.org/867.906/4.320382571983785/49.43846097119561/6.200660841932859
There seems to be a problem with the documentation, but the feature you want is apparently available in Mapbox-GL-JS within the last couple of months, according to this commit.
You should be able to do something like:
map.getSource('myvectortiles').setTiles(..)
or
map.getSource('myvectortiles').setSourceProperty(..)
to trigger an update. You may need to look at the source code for more details.
If you just want to update tiles source url, you can just use setTiles function.
map.getSource('source-id').setTiles(['https://newtilesourceurl']);
This updates the source url and re-renders the layer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With