Skip to content

greatCircle broken for routes crossing the antimeridian in v7.3.2+ #3030

@MaximeKoitsalu

Description

@MaximeKoitsalu

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

  1. Create great circle routes between coordinates that cross the antimeridian
  2. 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):
Image

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):
Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions