Along returns out of bounds coordinates when antimeridian crossed
Open
Nobody has claimed this yet.
@turf/along
antimeridian
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
var line = turf.lineString([[-82.461, 35.3187], [144.985, -37.813]]);
var segment = turf.along(line, 1500);
console.log(segment.geometry.coordinates);
this outputs 262.6856469517484, 30.179864583770968
Because of this, when I do the LineString in MapBox between [-82.461, 35.3187] and 262.6856469517484, 30.179864583770968, it looks like this:

Isn't it supposed to output -97.314353, 30.179864583770968 instead?
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 by reproducing the issue with the provided turf.lineString and turf.along example, then inspect the turf.along entry point and its coordinate calculations. Confirm whether the returned longitude should be normalized to -180..180, and add regression coverage showing the expected -97.314353 result for this antimeridian-crossing line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100