geojs icon indicating copy to clipboard operation
geojs copied to clipboard

Add an A/B layer feature

Open manthey opened this issue 4 years ago • 1 comments

When changing URLs in tile layers, it is often handy to have two layers where one is hidden loading the new url. When the hidden layer is fully loaded, the two layers' visibility is swapped. This can be done where multiple changes to the url always affect the hidden layer (delaying any change in view) or are queued so that intermediate changes are visible.

This could be done in an abstract manner where the A/B buffered layer could be any layer type. Only specific calls would be buffered; all others would affect both layers equally. The two layers would always be adjacent in the z-stack and would not be eligible to share rendering contexts with other layers.

manthey avatar Nov 15 '19 14:11 manthey

For tile layers, having a single layer where the tiles suddenly swap would be preferable. Specifically, we rate limit concurrent tile requests to six per domain, and, if both urls are from the same domain, it would be good to share this throttle. Further, the switch should occur as soon as all required tiles are available (not all tiles in the queue). With a single layer, you would have a shown url, a target url (not necessarily the same), and, possibly, a secondary url (so if you are switching A-B-A, you don't need to refetch all of the A tiles if they haven't fallen out of memory). If the tile cache includes the url, then perhaps maintaining the secondary url become superfluous.

If the shown url and target urls are different (because the target isn't loaded enough to switch), and navigation occurs requiring different tiles, I think we'd want to load the shown url tiles faster than getting ready to switch to the target url. If the target is updated before it is ready, naturally some tiles will have been loaded without ever being shown.

manthey avatar Nov 03 '20 19:11 manthey