Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid tile popping/flicker on RasterTileSource setTiles #12707

Open
jo-chemla opened this issue May 11, 2023 · 4 comments
Open

Avoid tile popping/flicker on RasterTileSource setTiles #12707

jo-chemla opened this issue May 11, 2023 · 4 comments

Comments

@jo-chemla
Copy link

jo-chemla commented May 11, 2023

Motivation

This dynamic raster tiles support PR is a great addition, especially for periodic/multi-temporal raster tilesets.

However, it induces tiles popping on tiles url update, as shown in this react-map-gl issue.
When one does use setTiles with a single TMS url, the previous rasterLayer tiles of the source are dumped - resulting in the map background style being displayed for a short amount of time until the new tiles are loaded and start populating the map.
This makes for a harsh transition especially for periodic tilesets.

Design Alternatives

What would be interesting is to allow for a different approach, to unload each tile only when the new one is loaded, similar to how zoom.earth works.

Mock-Up

Mapbox example with tiles popping

2023-05-11.10.05.10.mp4

Zoom.earth example without tiles popping

2023-05-11.10.16.21.mp4
@jo-chemla jo-chemla changed the title Avoid tile popping on RasterTileSource setTiles Avoid tile popping/flicker on RasterTileSource setTiles May 12, 2023
@jo-chemla
Copy link
Author

jo-chemla commented May 12, 2023

Bugfix for a similar issue on ImageSource shown in this issue/PR. It involved retaining the _loaded status on the source while fetching the new image.

Probably cannot be applied here since this property is at the source level rather than for each tile, but might be useful.

@underbluewaters
Copy link

I'd love to see RasterSource match the behavior ImageSource. I'm trying to choose between using ImageSource vs Raster for showing Esri dynamic map services. I have to choose between an old-school presentation where an image for the whole viewport is requested or a more appealing tiled presentation. Unfortunately changing the layers requested with the tiled presentation results in this "tile popping" so I will probably use ImageSource instead.

@jo-chemla
Copy link
Author

jo-chemla commented Aug 23, 2023

I'm trying to choose between using ImageSource vs Raster for showing Esri dynamic map services.

Exactly in the same mindset, using ImageSource could be a replacement to avoid tile popping for wmts server, requesting an image at viewport extent and resolution.

It might not work for all cases, especially for non-matching or non-mercator projections, plus wondering what would happen at low zoom levels in globe view for example.

By the way, did not know about frontiersi/mapbox-gl-esri-sources , interesting library for the task.

@tb4764
Copy link

tb4764 commented May 7, 2024

I came up with mapbox-gl.js from another branch a while ago for a different purpose, but, don't know how, it doesn't show the flicker effect when calling setTiles.
To make it work, replace your mapbox-gl.js in the dist directory with the one attached.
I've already spent some time to figure out what's different, but didn't get anywhere. At least it works for now.
mapbox-gl.js.zip

It would be nice if someone decodes this, and makes a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants