mapbox / mapbox/mapbox-gl-js

Improve feature query precision near horizon in globe view

Open
#11,745 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature querying uses raycasting to project screen rectangles into query polygons in Mercator coordinates. In globe view the farthest possible point returned from raycasting is at horizon where the direction of the ray is perpendicular to the surface normal. In other words it's only possible to click visible side of the globe. This behavior sets a limitation on how far the query polygon can reach.

This leads to following imprecision where certain features slightly behind the horizon might be missed. This happens because occlusion checks is done using the camera far plane which seems to be placed slightly behind the horizon.

https://user-images.githubusercontent.com/7061573/163066508-1b20852a-e96d-433b-817c-e95b354d7c0e.mov

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 by tracing globe-view feature querying, raycasting from screen rectangles into Mercator query polygons, and the camera far-plane occlusion check described in the issue. Reproduce the linked horizon case; done means features slightly behind the horizon are no longer missed without allowing queries against the invisible side of the globe.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.