Skip to content

Conversation

@dwayneparton
Copy link

@dwayneparton dwayneparton commented Jan 5, 2026

Issue

When using terrain with a DEM source that has a lower maxzoom than the current display zoom (e.g., DEM maxzoom of 10 while viewing at zoom 14), the pointCoordinate raycast was not consistent with the rendered terrain. This caused issues where clicking on the visible terrain surface would return incorrect 3D coordinates.

{"type":"raster-dem","tiles":["https://example.tile.server/v1/terrain/{z}/{x}/{y}.png"],"tileSize":256,"maxzoom":10,"encoding":"terrarium"}
bug-raycast-on-overscaled-tiles.mov

Solution

The raycast now uses a proxy tile-based approach when overzoomed, which matches the exact geometry rendered by the terrain shader.

fix-raycast-on-proxied-tiles.mov

API Changes

No API Changes

Launch Checklist

  • Make sure the PR title is descriptive and preferably reflects the change from the user's perspective.
  • Add additional detail and context in the PR description (with screenshots/videos if there are visual changes).
  • Manually test the debug page.
  • Write tests for all new functionality and make sure the CI checks pass.
  • Document any changes to public APIs.
  • Post benchmark scores if the change could affect performance.

Initial Draft

Intent is to show the issue and potential fix for support request 176617. Happy to add some tests, I did some rudimentary benchmark tests but this needs to be done a bit more in depth.

@CLAassistant
Copy link

CLAassistant commented Jan 5, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

Hey, @dwayneparton 👋 Thanks for your contribution to Mapbox GL JS!

Important: This repository does not accept direct merges. All changes go through our internal review process.

What happens next:

  1. A team member will review your PR here first
  2. If it looks good, they will import it to our internal repository for further review
  3. If approved, changes will be synced back here via our release process

Please respond to any review comments on this PR. For more details, see CONTRIBUTING.md.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants