plotly / plotly/plotly.js

[Feature Request / Bug]: Limitations in scattergeo and natural earth projection when handling antimeridian crossing and programmatic centering

Open
#8,046 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2 size: 3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

Description
When working with long-haul transpacific flight tracks that cross the 180° meridian (antimeridian) on a 2D map view (natural earth projection), scattergeo exhibits severe limitations regarding automatic centering, zooming, and boundary rendering.

Specifically, attempting to programmatically center the map on routes crossing the dateline results in projection clipping or shifts the view incorrectly (e.g., to the Atlantic/African perspective). While injecting null values into coordinate arrays successfully prevents straight lines from stretching awkwardly across the entire globe, it breaks standard spherical centroid and midpoint calculations. Furthermore, because bounded 2D projections like natural earth lack infinite horizontal wrapping, smooth centering across the antimeridian is virtually unsupported.

Steps to reproduce
Set up a scattergeo plot using the natural earth projection (geo.projection.type: 'natural earth').

Plot a flight path with coordinates crossing the 180° meridian (e.g., from Vancouver [-123.18, 49.19] across the Pacific to Seoul [126.44, 37.46]).

Attempt to programmatically update geo.center or geo.projection.rotation.lon to focus/zoom into the midpoint of the route.

Note the issue: The flat 2D projection either clips/shifts the viewport entirely away from the Pacific or forces lines to span across the map, as there is no native antimeridian-aware centering support for bounded 2D geo projections.

Notes
This issue impacts custom flight dash applications using scattergeo where users want to select specific routes to zoom into. Having native support for antimeridian-aware bounding/centering or seamless horizontal wrapping in flat 2D projections would eliminate the need for complex workaround scripts.

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 scattergeo configuration using the natural earth projection, especially geo.center and geo.projection.rotation.lon, and reproduce the Vancouver–Seoul route crossing the antimeridian. Investigate how centering, zooming, boundary rendering, and coordinate arrays behave for this case. Done means a 2D natural earth map can focus on such routes without clipping, incorrect shifts, or globe-spanning lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.