mapbox / mapbox/mapbox-gl-js

Avoid tile popping/flicker on RasterTileSource setTiles

Open
#12,707 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

## Motivation

This `dynamic raster tiles support` [PR](https://github.com/mapbox/mapbox-gl-js/pull/12352) 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](https://github.com/visgl/react-map-gl/issues/1876).
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](https://zoom.earth/maps/satellite/) works.

### Mock-Up

Mapbox example with tiles popping

https://github.com/mapbox/mapbox-gl-js/assets/16822841/ec032bfd-797c-4303-92b7-bba53334f8d2

Zoom.earth example without tiles popping

https://github.com/mapbox/mapbox-gl-js/assets/16822841/acea8ee4-5ef2-410f-875e-470ac9322271

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RasterTileSource.setTiles and the dynamic raster tiles support PR linked in the issue. Trace how existing raster tiles are discarded during a tile URL update. Done should mean old tiles remain visible until their replacements load, avoiding the background-style flash and tile popping shown in the examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.