mapbox / mapbox/mapbox-gl-js

`map.setTerrain` makes vector tiles disappear

Open
#13,243 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 3.5.2

**browser**: chrome 127.0.6533.72 (Official Build) (64-bit)

First of all, I want to thank you for this awesome project!

### Steps to Trigger Behavior

1. Load vector tiles data source with `maxzoom` set to 0 (`map.addSource(id, { ..., maxzoom: 0 });`)
2. Set Terrain `map.setTerrain({ source: "mapbox-dem", exaggeration: 1 });` (there are no problems if set `map.setTerrain(null);`)
3. Zoom in 14 points more than the data source `maxzoom` (in my case 0 + 14 = 14)

### Link to Demonstration

[demo](https://codesandbox.io/p/sandbox/dry-pine-vvzzpn?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clz6wq3zp00072a690qpvcx38%2522%252C%2522sizes%2522%253A%255Bnull%252Cnull%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clz6wq3zp00032a69fpud4uo7%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clz6wq3zp00042a693lfvbnqy%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clz6ymm8200o42a69z4lze8gd%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B56.79805340811876%252C43.20194659188124%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clz6wq3zp00032a69fpud4uo7%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clz6wq3zp00022a690vsr3xh7%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A14%252C%2522startColumn%2522%253A1%252C%2522endLineNumber%2522%253A14%252C%2522endColumn%2522%253A1%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252FCustomMap.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522clz6wq3zp00032a69fpud4uo7%2522%252C%2522activeTabId%2522%253A%2522clz6wq3zp00022a690vsr3xh7%2522%257D%252C%2522clz6wq3zp00042a693lfvbnqy%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clz6wq3zp00042a693lfvbnqy%2522%257D%252C%2522clz6ymm8200o42a69z4lze8gd%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clz6yl8er00o12a69zjd6tm6d%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clz6ymm8200o42a69z4lze8gd%2522%252C%2522activeTabId%2522%253A%2522clz6yl8er00o12a69zjd6tm6d%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A17.98179529755356%257D)

### Expected Behavior

Figures don't disappear

### Actual Behavior
Polygons disappear under `maxzoom` + 14
![video-polygon](https://github.com/user-attachments/assets/3a520933-3abf-4c16-b70c-2cd3bb8436d1)

Points disappear when changing the angle of the camera on a high-zoom
![video-point](https://github.com/user-attachments/assets/2fa11365-115b-4cdb-83f0-b559424e3814)

It might be helpful to know how I split a geojson file into tiles. The original geojson, script, and tiles can be found in the following [resources.zip](https://github.com/user-attachments/files/16414202/resources.zip)

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

Run the linked CodeSandbox in Chrome and reproduce the disappearance using map.addSource with maxzoom 0, map.setTerrain, and a zoom 14 points higher. Compare the polygon and point cases, then inspect the supplied resources.zip if needed. Done means vector-tile figures remain visible with terrain enabled at the reported zoom and camera angles.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.