Skip to content

Fix simplification of short antimeridian crossings - #68

Merged
sgraaf merged 2 commits into
sgraaf:mainfrom
shkyyy18:fix/simplify-antimeridian
Sep 30, 2026
Merged

sgraaf merged 2 commits into
sgraaf:mainfrom
shkyyy18:fix/simplify-antimeridian

Conversation

@shkyyy18

Copy link
Copy Markdown
Contributor

Bug

simplify() projects longitude by subtracting the start longitude directly. For a short straight track with longitudes 179.9, 180, -179.9 at latitude 0, that treats the endpoint displacement as -359.8 degrees instead of +0.2 degrees. The intermediate collinear point is consequently retained even with a 5 metre tolerance. The same problem occurs for westbound crossings and either spelling of the dateline (180 or -180).

Fix

Normalize each local longitude displacement to [-pi, pi) before applying the existing equirectangular projection. This keeps the current small-track projection and public API, while handling the longitude seam correctly. This does not claim to support globally winding tracks or change the existing projection's large-extent limitations.

Regression coverage and validation

  • Four synthetic straight-crossing cases (east/west, +/-180) fail on upstream main and pass with the fix.
  • Two additional route cases ensure a significant bend across the dateline remains intact.
  • Input point lists remain unchanged.
  • Full suite: 902 passed, tested locally on Python 3.12 and 3.13.
  • All configured prek run --all-files hooks passed on Python 3.13, including Ruff, the five type checkers and generated CLI documentation.
  • Updated changelog and README per contributing guidance. No new dependencies or CI changes.

Prepared with AI assistance; the regression failure and full validation were run against a local checkout using synthetic coordinates only.

@sgraaf

sgraaf commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Hi! Thank you for this bug fix. I noticed there was a misplaced line in the README, which I have removed. Other than that: LGTM!

@sgraaf sgraaf self-assigned this Sep 30, 2026
@sgraaf
sgraaf merged commit 1b3dca1 into sgraaf:main Sep 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants