map.flyTo avoids crossing the antimeridian when projection is globe
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 2.15.0
**browser**: Firefox 114.0.2 (or latest chrome also)
### Steps to Trigger Behavior
1. Try to fly from somewhere far east in the eastearn hemisphere to somewhere west in the western hemisphere.
With a globe projection, the map will go westwards (around the world), while other projections like the mercator projection will go eastwards (the shorter route).
This is related to #2071 and #1853.
### Link to Demonstration
https://github.com/mapbox/mapbox-gl-js/assets/64247965/8aa6fd6a-744f-441c-9e3c-6456bb41fde9
Code to reproduce:
```
map.flyTo({
center: [180, 0],
});
setTimeout(() => {
map.flyTo({
center: [-180, 0],
});
}, 2500);
```
### Expected Behavior
Take the shortest possible path.
### Actual Behavior
Stays on w=0 and goes "the wrong way around" the globe.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the map.flyTo entry point and reproduce the transition from [180, 0] to [-180, 0] with globe projection. Compare the route with the mercator behavior and verify that the globe animation takes the shortest path around the antimeridian.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100