visgl / visgl/deck.gl

Maplibre/Mapbox elevation support w/o terrain

Open
#9,754 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
14.6k
Forks
2.3k
Avg merge
2d 9h
Merged PRs (30d)
42

Description

getViewState() in deck-utils.ts only calls centerCameraOnTerrain() when terrain is enabled:

https://github.com/visgl/deck.gl/blob/024534cc087af7c10c5c6d1316cf06bffe01cceb/modules/mapbox/src/deck-utils.ts#L239-L242

However both base map providers (Mapbox & MapLibre) support setting camera elevation even when terrain is disabled. (Mapbox by using Map#setFreeCameraOptions(), MapLibre by using Map#jumpTo({ elevation: ... })).

I'm using this configuration (camera elevation, but no terrain) to render 3D models in tandem with map markers for architectural visualizations. Deck.gl layers in this mode are being rendered at an incorrect altitude due to not taking camera elevation into account.

It'd be nice if deck.gl supported this use case by either calling centerCameraOnTerrain() unconditionally or (if it's a performance optimization) by providing a configuration option to do so.

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 in modules/mapbox/src/deck-utils.ts at getViewState(), especially the conditional call to centerCameraOnTerrain(). Read how the Mapbox and MapLibre camera elevation APIs behave when terrain is disabled, then verify that deck.gl layers use the camera elevation correctly in that configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.