Projected coordinates are not being unprojected back to the same coordinates
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
`unproject()` seems to be returning the incorrect coordinates when point is off screen. This issue becomes more apparent on higher zoom levels. The objective is to draw multiple lines between two points using only two sets of coordinates.
In the example below, I've removed all calculations I was performing on each zoom event and only projecting then unprojecting the same coordinates.
**mapbox-gl-js version**: version: v2.6.0
**browser**: Tested on Chrome, Safari, Firefox
### Steps to Trigger Behavior
1. Draw a line between using two sets of coordinates by adding a source with a line layer
2. On zoom event, project the each coordinate then unproject each coordinate and update source with resulting coordinates.
### Expected Behavior
**Zoomed out**

**Zoomed in at level 16**

### Actual Behavior
**Zoomed in at level 16**

**I manually added the line at zoom 16 then zoomed out to see the resulting line:**

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
The issue names no source file or test; start by reproducing the project/unproject round trip during zoom events at a high zoom level, using the described two-coordinate line example. Trace the map.project() and map.unproject() entry points and verify that off-screen coordinates remain unchanged after the round trip.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100