mapbox / mapbox/mapbox-gl-js

Globe does not use shortest path for line geometry between points

Open
#11,813 7 comments 1 reaction 1 assignee Claimed by @ansis View on GitHub
3d :triangular_ruler: needs discussion :speech_balloon:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**Current behavior**

Line geometry between two points on globe does not use use shortest distance and there can be non-intuitive behavior around the poles where the points are always projected in the mercator space. This is especially visible in mapbox-gl-draw, where the user can drag points on the globe and create geometry on the fly:

https://user-images.githubusercontent.com/7061573/164815481-3ce73cb1-7364-4055-98c2-92ab9d3befd5.mov

**Proposed behavior**

Line geometry between two points on globe follows shortest distance and are either processed and subdivided in geojson-vt or on the fly. (A useful library might be https://github.com/mapbox/cheap-ruler).

This has a few challenges:

- During the globe mercator transition, the subdivision between points would have to be interpolated between their representation in globe and their representation in mercator
- A discontinuity in mercator is a continuity in globe

**Workaround**

The geometry is subdivided and adapted before feeding it to mapbox-gl.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.