mapbox / mapbox/mapbox-gl-js

recursive tile loading for 404s doesn't work for dem tiles

Open
#11,161 2 comments 0 reactions 1 assignee View on GitHub

@stepankuzmin is already working on this.

Since Nov 10, 2021.

  • #11276 by @stepankuzmin — merged
bug :lady_beetle: needs discussion :speech_balloon:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

If the terrain dem tileset is sparse (tiles don't go up to the full maxzoom in all areas), terrain tiles can fail to load. Terrain only loads after a bunch of panning or zooming. Discovered through https://github.com/mapbox/mapbox-gl-js/issues/11153

**mapbox-gl-js version**: main

**browser**: all

### Steps to Trigger Behavior

1. add a sparse dem tile source
2. load the map in an area where the tiles don't go up to the max zoom level with a zoom greater than the max zoom that returns tiles.

### Link to Demonstration

// internal

### Expected Behavior

Terrain loads.

### Actual Behavior

Terrain only loads after a bunch of panning.

---

If a tile 404s, we call `sourceCache.update(...)` to continue looking for a parent tile:
https://github.com/mapbox/mapbox-gl-js/blob/f919053d277cbb55ad1bafb76e7f1d7d5f94f486/src/source/source_cache.js#L242-L244

But we skip the update for terrain tiles (as an optimization, not intended for this situtation):
https://github.com/mapbox/mapbox-gl-js/blob/f919053d277cbb55ad1bafb76e7f1d7d5f94f486/src/source/source_cache.js#L472-L475

If we pass the right flag to `update(...)`, tiles will load successfully.

If we want to rely on recursive tile loading we need to review it carefully and add more tests. I don't think we've relied on this before, so I'm not confident there aren't other bugs.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.