greatCircle broken for routes crossing the antimeridian in v7.3.2+
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
Great circle routes that cross the antimeridian (International Date Line, ±180° longitude) are rendering incorrectly starting
from version 7.3.2. Lines appear broken or disconnected around the date line, whereas they render correctly as smooth arcs
in version 7.3.1.
Versions Affected
- Working: @turf/turf@7.3.1 (or @turf/great-circle@7.3.1)
- Broken: @turf/turf@7.3.2 and later (tested up to 7.3.4)
Steps to Reproduce
- Create great circle routes between coordinates that cross the antimeridian
- Example routes:
- Tokyo (139.78, 35.55) → Los Angeles (-118.41, 33.94)
- Auckland (174.79, -36.85) → Los Angeles (-118.41, 33.94)
- Shanghai (121.81, 31.14) → San Francisco (-122.38, 37.62)
Live reproduction: https://codepen.io/maximekoitsalu-the-styleful/pen/pvEoyPR
Click the version buttons to toggle between 7.3.1 (working) and 7.3.2 (broken).
Expected Behavior
Great circle routes should render as smooth, continuous arcs across the Pacific Ocean, properly handling the antimeridian
crossing. The route should take the shorter great circle path.
Screenshot from v7.3.1 (working):
Actual Behavior
In v7.3.2+, routes crossing the antimeridian appear broken, disconnected, or render as straight lines instead of following
the great circle path. The lines break at or near the ±180° longitude boundary.
Screenshot from v7.3.2 (broken):
Code Example
const turf = require('@turf/turf');
const tokyo = turf.point([139.7798, 35.5494]);
const losAngeles = turf.point([-118.4085, 33.9416]);
const greatCircle = turf.greatCircle(tokyo, losAngeles, { npoints: 100 });
// In v7.3.1: Returns proper arc coordinates
// In v7.3.2+: Returns broken/incorrect coordinates around antimeridian
Environment
- Browser: Chrome/Firefox/Safari (affects all browsers)
- Map Library: MapLibre GL JS 5.0.0 (but issue is library-agnostic)
- Coordinates: Any routes crossing the antimeridian (~±180° longitude)
Possible Cause
This appears to be related to changes in how coordinate wrapping or antimeridian crossing is handled between v7.3.1 and
v7.3.2. The issue specifically manifests when the great circle path crosses from positive to negative longitude (or vice
versa) near ±180°.
Impact
This breaks flight route visualization and any application that needs to render great circle paths across the Pacific Ocean
or other regions that span the antimeridian. This is a regression from the working v7.3.1 behavior.
Workaround
Currently pinning to @turf/turf@7.3.1 or @turf/great-circle@7.3.1 until this is resolved.
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 @turf/great-circle package and compare its behavior between versions 7.3.1 and 7.3.2 using the Tokyo–Los Angeles example or the linked reproduction. Check routes that cross ±180° longitude and add coverage for the listed examples if the package has corresponding tests. Done means the routes return and render as continuous great-circle arcs across the antimeridian.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100