fix(great-circle): fix antimeridian splitting by upgrading arc to v1.0.0#3048
Open
thomas-hervey wants to merge 1 commit intoTurfjs:masterfrom
Open
fix(great-circle): fix antimeridian splitting by upgrading arc to v1.0.0#3048thomas-hervey wants to merge 1 commit intoTurfjs:masterfrom
thomas-hervey wants to merge 1 commit intoTurfjs:masterfrom
Conversation
Fixes Turfjs#3030 Routes crossing the international dateline (e.g. Tokyo-LAX, Auckland-LAX, Shanghai-SFO) were returning a malformed MultiLineString with a gap at the +/-180 boundary. This was caused by a bug in the GDAL-ported linear heuristic in arc.js v0.1.x/v0.2.x. arc v1.0.0 replaces the heuristic with analytical bisection, producing exact +/-180 boundary coordinates and a correctly closed MultiLineString. Changes: - Bump arc dependency from ^0.2.0 to ^1.0.0 - Remove offset from Arc() call - antimeridian splitting is now automatic - Mark options.offset as deprecated in JSDoc (kept for backward compat) - Remove unused offset destructuring - Add three antimeridian test fixtures: Tokyo-LAX, Auckland-LAX, Shanghai-SFO - Add tape tests asserting MultiLineString output and exact +/-180 boundary coords - Fix fixture-dependent tests to use named getFixture() lookup instead of fixtures[0] - Regenerate basic.geojson snapshot (arc@1.0.0 defaults to 100 points)
Contributor
Author
|
@smallsaucepan @rowanwins I see that you've contributed more recently and was wondering if I could get your review on this PR. In short, it's a bump of the Thanks! |
Member
|
Thanks for this. While checking to see if this might fix the sourcemap issue #2721 as well noticed that arc as of 1.0.0 is ESM only? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3030
Details
Routes crossing the international dateline (e.g. Tokyo-LAX, Auckland-LAX, Shanghai-SFO) were returning a malformed MultiLineString with a gap at the +/-180 boundary. This was caused by a bug in the GDAL-ported linear heuristic in arc.js v0.1.x/v0.2.x.
Fix
arc v1.0.0 replaces the heuristic with analytical bisection, producing exact +/-180 boundary coordinates and a correctly closed MultiLineString.
Changes:
offsetfrom Arc() call. Antimeridian splitting is now automaticoptions.offsetas deprecated in JSDoc (kept for backward compat)offsetdestructuringTest
When testing locally, arc@0.2.0 fails, but passes at arc@1.0.0
... and the visual results were verified in geojson.io (see screenshot below)

Please provide the following when creating a PR:
contributorsfield ofpackage.json- you've earned it! 👏