mapbox / mapbox/mapbox-gl-js

mapbox' project function depends on the center of the map being east or west of antimeridian

Open
#10,138 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs discussion :speech_balloon:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

map.project provides different results depending on the center of the map.

How to reproduce:
a)
- center map on the east side of the Pacific, e.g. 160°W,0. Zoom=3. north up.
- call map.project( [-160,0])
=> you might get something like [857,488] (almost the center of a large window)

b)
-now move map center to west side of anti-meridian, e.g. 160°E.
- call map.project( [-160,0]) again
=> you get something like [-2806,483]

But WHY -2806? The spot of -160,0 is still visible. The screen projection should yield something like [1200,480] – a jump right of a) because the map has been moved to the rigth as well between scenario a) and scenario b).

Am I missing anything?

**mapbox-gl-js version**: v1.12.0
**browser**: any

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 with the map.project API and reproduce the two cases at zoom 3 with map centers near 160°W and 160°E, using the coordinates and expected screen positions in the issue. Trace the antimeridian handling in the projection path; done means the visible point produces a consistent nearby screen coordinate after the map center crosses the antimeridian.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.