mapbox / mapbox/mapbox-gl-js

Add optional elevation arguments for project()/unproject()

Open
#6,415 4 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3d :triangular_ruler: feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

I'd like to be able to incorporate altitude both when converting a pixel value to a lnglat coordinate, and vice versa. This would allow us to make calculations and reason about the map, in full 3D space. Example questions this would answer are:

`map.project(lnglat, elevation)`: where on the screen would an object at *this* coordinate and *this* elevation appear?

`map.unproject(px, elevation)`: Say I'm hovering on the rooftop of a building extrusion of known height. What's the ground coordinate that corresponds to this pixel value?

This would be an optional parameter that defaults to, and has a minimum of 0.

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 at the project() and unproject() entry points and trace the existing pixel-to-coordinate conversions. Define how the optional elevation argument defaults to and is constrained at 0, then verify that both conversions account for the supplied elevation in 3D map calculations.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, frontend
Issue type
Feature
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.