visgl / visgl/react-map-gl

[Bug] Terrain has a weird behavior on zoom.

Open
#2,555 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.5k
Forks
1.4k
Avg merge
5d 17h
Merged PRs (30d)
3

Description

Description

When using the Mapbox terrain layer, zooming in closely causes markers to behave inconsistently — they flicker or jump back and forth instead of staying stable.

This is a screenshots:

Image Image Image Image

And this is the code:
<Map key={mapBoxStyle} ref={mapRefCallback} mapboxAccessToken={mapBoxAccessToken} initialViewState={viewport} mapStyle={mapBoxStyle} onMouseMove={onMouseMove} onMove={evt => setViewport(evt.viewState)} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} projection='globe' onClick={onClick} onContextMenu={onContextMenu} interactiveLayerIds={['docks', 'drones']} terrain={{ source: 'mapbox-raster-dem', exaggeration: 1, }} // maxZoom={19} > <Source id='mapbox-raster-dem' type='raster-dem' url='mapbox://mapbox.mapbox-terrain-dem-v1' tileSize={512} maxzoom={20} /> </Map>

Expected Behavior

Markers should remain stable and fixed in place when zooming.

Steps to Reproduce
  1. Enable the terrain layer.
  2. Zoom in deeply on the map.
  3. Observe the marker positions.
Environment
  • Framework version: "react-map-gl": "^8.0.1",
  • Map library: Mapbox (mapbox-gl)- "^3.9.4",
  • Browser: Chrome and Firefox.
  • OS: Mac and Linux.
Logs

No response

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 the component configuration shown in the issue and reproduce the behavior using the terrain source, globe projection, and deeply zoomed viewport. Investigate how terrain affects marker positioning, then verify that markers remain stable while zooming in Chrome and Firefox on the reported environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
data-visualization, 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.