From 030b734db8f11ca240555e890949b2f80f2f38ee Mon Sep 17 00:00:00 2001 From: Thomas Hervey Date: Mon, 13 Apr 2026 14:00:43 -0700 Subject: [PATCH 1/2] fix(great-circle): fix antimeridian splitting by upgrading arc to v1.0.0 Fixes https://github.com/Turfjs/turf/issues/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) --- packages/turf-great-circle/README.md | 3 +- packages/turf-great-circle/index.ts | 7 +- packages/turf-great-circle/package.json | 2 +- packages/turf-great-circle/test.ts | 68 +++++++-- .../test/in/antimeridian-auckland-lax.geojson | 21 +++ .../test/in/antimeridian-shanghai-sfo.geojson | 21 +++ .../test/in/antimeridian-tokyo-lax.geojson | 21 +++ .../out/antimeridian-auckland-lax.geojson | 140 ++++++++++++++++++ .../out/antimeridian-shanghai-sfo.geojson | 140 ++++++++++++++++++ .../test/out/antimeridian-tokyo-lax.geojson | 140 ++++++++++++++++++ .../turf-great-circle/test/out/basic.geojson | 2 +- pnpm-lock.yaml | 17 ++- 12 files changed, 556 insertions(+), 26 deletions(-) create mode 100644 packages/turf-great-circle/test/in/antimeridian-auckland-lax.geojson create mode 100644 packages/turf-great-circle/test/in/antimeridian-shanghai-sfo.geojson create mode 100644 packages/turf-great-circle/test/in/antimeridian-tokyo-lax.geojson create mode 100644 packages/turf-great-circle/test/out/antimeridian-auckland-lax.geojson create mode 100644 packages/turf-great-circle/test/out/antimeridian-shanghai-sfo.geojson create mode 100644 packages/turf-great-circle/test/out/antimeridian-tokyo-lax.geojson diff --git a/packages/turf-great-circle/README.md b/packages/turf-great-circle/README.md index 30eae73ae8..1ce96a423a 100644 --- a/packages/turf-great-circle/README.md +++ b/packages/turf-great-circle/README.md @@ -17,8 +17,7 @@ then a `LineString` will be returned with duplicate coordinates the length of th * `options.properties` **[Object][4]** line feature properties (optional, default `{}`) * `options.npoints` **[number][5]** number of points (optional, default `100`) - * `options.offset` **[number][5]** offset controls the likelyhood that lines will - be split which cross the dateline. The higher the number the more likely. (optional, default `10`) + * `options.offset` **[number][5]?** NOTE: deprecated: Antimeridian splitting is now automatic and this option has no effect ### Examples diff --git a/packages/turf-great-circle/index.ts b/packages/turf-great-circle/index.ts index 4824e49c11..f727568dd7 100644 --- a/packages/turf-great-circle/index.ts +++ b/packages/turf-great-circle/index.ts @@ -22,8 +22,7 @@ import { GreatCircle } from "arc"; * @param {Object} [options={}] Optional parameters * @param {Object} [options.properties={}] line feature properties * @param {number} [options.npoints=100] number of points - * @param {number} [options.offset=10] offset controls the likelyhood that lines will - * be split which cross the dateline. The higher the number the more likely. + * @param {number} [options.offset] NOTE: deprecated: Antimeridian splitting is now automatic and this option has no effect * @returns {Feature} great circle line feature * @example * var start = turf.point([-122, 48]); @@ -45,7 +44,7 @@ function greatCircle( ): Feature { // Optional parameters if (typeof options !== "object") throw new Error("options is invalid"); - const { properties = {}, npoints = 100, offset = 10 } = options; + const { properties = {}, npoints = 100 } = options; const startCoord = getCoord(start); const endCoord = getCoord(end); @@ -61,7 +60,7 @@ function greatCircle( properties || {} ); - const line = generator.Arc(npoints, { offset: offset }); + const line = generator.Arc(npoints); return line.json() as Feature< LineString | MultiLineString, diff --git a/packages/turf-great-circle/package.json b/packages/turf-great-circle/package.json index 10eeb133de..c0da5f9077 100644 --- a/packages/turf-great-circle/package.json +++ b/packages/turf-great-circle/package.json @@ -73,7 +73,7 @@ "@turf/helpers": "workspace:*", "@turf/invariant": "workspace:*", "@types/geojson": "^7946.0.10", - "arc": "^0.2.0", + "arc": "^1.0.0", "tslib": "^2.8.1" } } diff --git a/packages/turf-great-circle/test.ts b/packages/turf-great-circle/test.ts index 31ab691e20..d970751928 100644 --- a/packages/turf-great-circle/test.ts +++ b/packages/turf-great-circle/test.ts @@ -7,6 +7,7 @@ import { writeJsonFileSync } from "write-json-file"; import type { FeatureCollection, LineString, + MultiLineString, Feature, Geometry, Point, @@ -40,6 +41,12 @@ function getStartEndPoints(fixture: (typeof fixtures)[0]) { return { start, end }; } +function getFixture(name: string) { + const fixture = fixtures.find((f) => f.name === name); + if (!fixture) throw new Error(`fixture not found: ${name}`); + return fixture; +} + test("turf-great-circle", (t) => { fixtures.forEach((fixture) => { const name = fixture.name; @@ -77,7 +84,7 @@ test("turf-great-circle with same input and output", (t) => { }); test("turf-great-circle accepts Feature inputs", (t) => { - const { start, end } = getStartEndPoints(fixtures[0]); + const { start, end } = getStartEndPoints(getFixture("basic")); t.doesNotThrow( () => greatCircle(start, end), "accepts Feature inputs" @@ -86,7 +93,7 @@ test("turf-great-circle accepts Feature inputs", (t) => { }); test("turf-great-circle accepts Point geometry inputs", (t) => { - const { start, end } = getStartEndPoints(fixtures[0]); + const { start, end } = getStartEndPoints(getFixture("basic")); t.doesNotThrow( () => greatCircle(start.geometry, end.geometry), "accepts Point geometry inputs" @@ -95,7 +102,7 @@ test("turf-great-circle accepts Point geometry inputs", (t) => { }); test("turf-great-circle accepts Position inputs", (t) => { - const { start, end } = getStartEndPoints(fixtures[0]); + const { start, end } = getStartEndPoints(getFixture("basic")); t.doesNotThrow( () => greatCircle(start.geometry.coordinates, end.geometry.coordinates), "accepts Position inputs" @@ -104,7 +111,7 @@ test("turf-great-circle accepts Position inputs", (t) => { }); test("turf-great-circle applies custom properties", (t) => { - const { start, end } = getStartEndPoints(fixtures[0]); + const { start, end } = getStartEndPoints(getFixture("basic")); const withProperties = greatCircle(start, end, { properties: { name: "Test Route" }, }); @@ -117,7 +124,7 @@ test("turf-great-circle applies custom properties", (t) => { }); test("turf-great-circle respects npoints option", (t) => { - const { start, end } = getStartEndPoints(fixtures[0]); + const { start, end } = getStartEndPoints(getFixture("basic")); const withCustomPoints = greatCircle(start, end, { npoints: 5 }); t.equal( (withCustomPoints.geometry as LineString).coordinates.length, @@ -127,13 +134,12 @@ test("turf-great-circle respects npoints option", (t) => { t.end(); }); -test("turf-great-circle respects offset and npoints options", (t) => { - const { start, end } = getStartEndPoints(fixtures[0]); - const withOffset = greatCircle(start, end, { offset: 100, npoints: 10 }); - t.equal( - (withOffset.geometry as LineString).coordinates.length, - 10, - "respects offset and npoints options" +test("turf-great-circle offset option is accepted but has no effect", (t) => { + const { start, end } = getStartEndPoints(getFixture("basic")); + // NOTE: offset is deprecated and a no-op since arc@1.0.0; antimeridian splitting is automatic with a MultiLineString result when needed. This test ensures that the option is accepted without throwing, but does not verify any behavior since it has no effect. + t.doesNotThrow( + () => greatCircle(start, end, { offset: 100, npoints: 10 }), + "accepts offset option without throwing" ); t.end(); }); @@ -150,3 +156,41 @@ test("turf-great-circle with antipodal start and end", (t) => { t.end(); }); + +// Antimeridian crossing fixtures. Each route crosses the international dateline and must produce a MultiLineString with segments that close and open exactly at ±180°. +[ + "antimeridian-tokyo-lax", + "antimeridian-auckland-lax", + "antimeridian-shanghai-sfo", +].forEach((fixtureName) => { + test(`turf-great-circle antimeridian split: ${fixtureName}`, (t) => { + const { start, end } = getStartEndPoints(getFixture(fixtureName)); + // NOTE: npoints=10 reproduces the original bug https://github.com/Turfjs/turf/issues/3030 (also confirmed by @jgravois) + const result = greatCircle(start, end, { npoints: 10 }); + const geom = result.geometry as MultiLineString; + + t.equal( + geom.type, + "MultiLineString", + "produces MultiLineString across antimeridian" + ); + + const lastOfFirst = geom.coordinates[0].at(-1)!; + const firstOfSecond = geom.coordinates[1][0]; + + t.ok( + Math.abs(Math.abs(lastOfFirst[0]) - 180) < 0.001, + "first segment ends at ±180°" + ); + t.ok( + Math.abs(Math.abs(firstOfSecond[0]) - 180) < 0.001, + "second segment starts at ±180°" + ); + t.ok( + Math.abs(lastOfFirst[1] - firstOfSecond[1]) < 0.001, + "latitude matches at antimeridian split" + ); + + t.end(); + }); +}); diff --git a/packages/turf-great-circle/test/in/antimeridian-auckland-lax.geojson b/packages/turf-great-circle/test/in/antimeridian-auckland-lax.geojson new file mode 100644 index 0000000000..e2b4e460c4 --- /dev/null +++ b/packages/turf-great-circle/test/in/antimeridian-auckland-lax.geojson @@ -0,0 +1,21 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { "name": "Auckland" }, + "geometry": { + "type": "Point", + "coordinates": [174.79, -36.85] + } + }, + { + "type": "Feature", + "properties": { "name": "Los Angeles" }, + "geometry": { + "type": "Point", + "coordinates": [-118.41, 33.94] + } + } + ] +} diff --git a/packages/turf-great-circle/test/in/antimeridian-shanghai-sfo.geojson b/packages/turf-great-circle/test/in/antimeridian-shanghai-sfo.geojson new file mode 100644 index 0000000000..be713a6708 --- /dev/null +++ b/packages/turf-great-circle/test/in/antimeridian-shanghai-sfo.geojson @@ -0,0 +1,21 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { "name": "Shanghai" }, + "geometry": { + "type": "Point", + "coordinates": [121.81, 31.14] + } + }, + { + "type": "Feature", + "properties": { "name": "San Francisco" }, + "geometry": { + "type": "Point", + "coordinates": [-122.38, 37.62] + } + } + ] +} diff --git a/packages/turf-great-circle/test/in/antimeridian-tokyo-lax.geojson b/packages/turf-great-circle/test/in/antimeridian-tokyo-lax.geojson new file mode 100644 index 0000000000..477d897494 --- /dev/null +++ b/packages/turf-great-circle/test/in/antimeridian-tokyo-lax.geojson @@ -0,0 +1,21 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { "name": "Tokyo" }, + "geometry": { + "type": "Point", + "coordinates": [139.7798, 35.5494] + } + }, + { + "type": "Feature", + "properties": { "name": "Los Angeles" }, + "geometry": { + "type": "Point", + "coordinates": [-118.4085, 33.9416] + } + } + ] +} diff --git a/packages/turf-great-circle/test/out/antimeridian-auckland-lax.geojson b/packages/turf-great-circle/test/out/antimeridian-auckland-lax.geojson new file mode 100644 index 0000000000..0611986e31 --- /dev/null +++ b/packages/turf-great-circle/test/out/antimeridian-auckland-lax.geojson @@ -0,0 +1,140 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "MultiLineString", + "coordinates": [ + [ + [174.79, -36.85], + [175.691979, -36.23329], + [176.579765, -35.609916], + [177.453753, -34.980132], + [178.314335, -34.344181], + [179.161902, -33.7023], + [179.996841, -33.054717], + [180, -33.052238] + ], + [ + [-180, -33.052238], + [-179.180464, -32.401654], + [-178.369634, -31.743323], + [-177.570293, -31.079931], + [-176.782073, -30.411677], + [-176.004608, -29.738754], + [-175.237542, -29.061348], + [-174.480521, -28.379638], + [-173.7332, -27.693799], + [-172.995237, -27.003999], + [-172.266299, -26.310402], + [-171.546059, -25.613163], + [-170.834194, -24.912436], + [-170.13039, -24.208369], + [-169.434337, -23.501103], + [-168.745734, -22.790779], + [-168.064281, -22.07753], + [-167.38969, -21.361486], + [-166.721673, -20.642774], + [-166.059951, -19.921517], + [-165.404251, -19.197834], + [-164.754301, -18.471841], + [-164.109839, -17.743652], + [-163.470605, -17.013375], + [-162.836345, -16.281118], + [-162.206808, -15.546986], + [-161.581749, -14.811081], + [-160.960926, -14.073502], + [-160.344102, -13.334346], + [-159.731042, -12.593709], + [-159.121517, -11.851685], + [-158.515298, -11.108364], + [-157.912163, -10.363837], + [-157.31189, -9.618192], + [-156.714261, -8.871515], + [-156.119059, -8.123892], + [-155.526072, -7.375407], + [-154.935089, -6.626144], + [-154.345899, -5.876184], + [-153.758295, -5.125609], + [-153.17207, -4.374499], + [-152.587021, -3.622933], + [-152.002943, -2.870992], + [-151.419634, -2.118753], + [-150.836891, -1.366295], + [-150.254514, -0.613695], + [-149.6723, 0.138967], + [-149.090048, 0.891616], + [-148.507559, 1.644172], + [-147.924631, 2.396558], + [-147.341061, 3.148697], + [-146.756648, 3.900508], + [-146.171189, 4.651915], + [-145.584479, 5.402837], + [-144.996314, 6.153194], + [-144.406486, 6.902906], + [-143.814787, 7.651892], + [-143.221007, 8.400068], + [-142.624934, 9.147351], + [-142.026353, 9.893657], + [-141.425049, 10.6389], + [-140.820801, 11.382992], + [-140.213388, 12.125845], + [-139.602584, 12.867367], + [-138.988161, 13.607468], + [-138.369888, 14.346053], + [-137.747528, 15.083025], + [-137.120844, 15.818288], + [-136.489592, 16.551739], + [-135.853525, 17.283277], + [-135.21239, 18.012796], + [-134.565932, 18.740187], + [-133.91389, 19.46534], + [-133.255998, 20.188141], + [-132.591984, 20.908472], + [-131.921572, 21.626213], + [-131.24448, 22.34124], + [-130.560422, 23.053425], + [-129.869102, 23.762635], + [-129.170223, 24.468736], + [-128.463479, 25.171587], + [-127.748558, 25.871043], + [-127.025144, 26.566955], + [-126.292912, 27.259169], + [-125.551532, 27.947526], + [-124.800669, 28.63186], + [-124.039979, 29.312001], + [-123.269115, 29.987773], + [-122.487721, 30.658994], + [-121.695437, 31.325475], + [-120.891897, 31.987022], + [-120.076729, 32.643432], + [-119.249557, 33.294497], + [-118.41, 33.94] + ] + ] + }, + "properties": {} + }, + { + "type": "Feature", + "properties": { + "name": "Auckland" + }, + "geometry": { + "type": "Point", + "coordinates": [174.79, -36.85] + } + }, + { + "type": "Feature", + "properties": { + "name": "Los Angeles" + }, + "geometry": { + "type": "Point", + "coordinates": [-118.41, 33.94] + } + } + ] +} diff --git a/packages/turf-great-circle/test/out/antimeridian-shanghai-sfo.geojson b/packages/turf-great-circle/test/out/antimeridian-shanghai-sfo.geojson new file mode 100644 index 0000000000..6229b88444 --- /dev/null +++ b/packages/turf-great-circle/test/out/antimeridian-shanghai-sfo.geojson @@ -0,0 +1,140 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "MultiLineString", + "coordinates": [ + [ + [121.81, 31.14], + [122.562652, 31.766723], + [123.325533, 32.388961], + [124.098958, 33.006541], + [124.883247, 33.619284], + [125.678723, 34.227007], + [126.485712, 34.829519], + [127.304544, 35.426624], + [128.135549, 36.018119], + [128.97906, 36.603796], + [129.835411, 37.183437], + [130.704936, 37.756821], + [131.587966, 38.323717], + [132.484834, 38.883889], + [133.395868, 39.437092], + [134.321391, 39.983075], + [135.261721, 40.521579], + [136.217172, 41.052338], + [137.188045, 41.575078], + [138.174634, 42.089519], + [139.177221, 42.595372], + [140.196071, 43.092342], + [141.231436, 43.580127], + [142.283547, 44.058416], + [143.352617, 44.526895], + [144.438832, 44.985241], + [145.542356, 45.433126], + [146.663319, 45.870216], + [147.801824, 46.296174], + [148.957937, 46.710656], + [150.131685, 47.113316], + [151.323058, 47.503806], + [152.531998, 47.881774], + [153.758403, 48.246867], + [155.00212, 48.598734], + [156.262945, 48.937023], + [157.540619, 49.261385], + [158.834823, 49.571475], + [160.145183, 49.866952], + [161.471261, 50.147482], + [162.812557, 50.412738], + [164.168509, 50.662404], + [165.538492, 50.896172], + [166.921816, 51.11375], + [168.31773, 51.314856], + [169.725421, 51.499227], + [171.144017, 51.666615], + [172.572591, 51.816793], + [174.010163, 51.949552], + [175.455703, 52.064704], + [176.908137, 52.162086], + [178.366355, 52.241557], + [179.82921, 52.303002], + [180, 52.308988] + ], + [ + [-180, 52.308988], + [-178.70447, 52.34633], + [-177.235878, 52.371478], + [-175.766218, 52.378408], + [-174.296704, 52.367111], + [-172.828546, 52.337602], + [-171.362949, 52.289925], + [-169.901099, 52.224151], + [-168.444164, 52.140377], + [-166.993282, 52.038722], + [-165.549555, 51.919335], + [-164.114048, 51.782385], + [-162.687777, 51.628063], + [-161.271712, 51.456583], + [-159.866766, 51.268179], + [-158.473797, 51.063101], + [-157.093604, 50.841617], + [-155.726923, 50.604012], + [-154.374428, 50.350582], + [-153.03673, 50.081636], + [-151.714376, 49.797494], + [-150.40785, 49.498485], + [-149.117575, 49.184943], + [-147.843912, 48.857212], + [-146.587165, 48.515638], + [-145.34758, 48.160569], + [-144.125348, 47.792359], + [-142.92061, 47.411358], + [-141.733458, 47.01792], + [-140.563936, 46.612395], + [-139.412047, 46.195131], + [-138.277753, 45.766475], + [-137.160979, 45.326767], + [-136.061617, 44.876345], + [-134.979526, 44.415542], + [-133.914538, 43.944683], + [-132.866459, 43.464089], + [-131.835074, 42.974076], + [-130.820145, 42.47495], + [-129.821417, 41.967012], + [-128.83862, 41.450556], + [-127.871469, 40.925869], + [-126.91967, 40.393229], + [-125.982916, 39.852909], + [-125.060895, 39.305173], + [-124.153286, 38.750277], + [-123.259764, 38.188472], + [-122.38, 37.62] + ] + ] + }, + "properties": {} + }, + { + "type": "Feature", + "properties": { + "name": "Shanghai" + }, + "geometry": { + "type": "Point", + "coordinates": [121.81, 31.14] + } + }, + { + "type": "Feature", + "properties": { + "name": "San Francisco" + }, + "geometry": { + "type": "Point", + "coordinates": [-122.38, 37.62] + } + } + ] +} diff --git a/packages/turf-great-circle/test/out/antimeridian-tokyo-lax.geojson b/packages/turf-great-circle/test/out/antimeridian-tokyo-lax.geojson new file mode 100644 index 0000000000..1ea95644eb --- /dev/null +++ b/packages/turf-great-circle/test/out/antimeridian-tokyo-lax.geojson @@ -0,0 +1,140 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "MultiLineString", + "coordinates": [ + [ + [139.7798, 35.5494], + [140.597651, 35.997257], + [141.424784, 36.439499], + [142.261337, 36.875971], + [143.107439, 37.306512], + [143.963218, 37.730961], + [144.828789, 38.149153], + [145.704266, 38.56092], + [146.589751, 38.966091], + [147.485336, 39.364495], + [148.391108, 39.755957], + [149.30714, 40.140298], + [150.233494, 40.51734], + [151.170222, 40.886902], + [152.117361, 41.248801], + [153.074936, 41.602853], + [154.042956, 41.948872], + [155.021415, 42.286672], + [156.010292, 42.616066], + [157.009548, 42.936866], + [158.019125, 43.248885], + [159.038948, 43.551936], + [160.068922, 43.845831], + [161.108933, 44.130385], + [162.158843, 44.405415], + [163.218496, 44.670737], + [164.287713, 44.926173], + [165.366291, 45.171544], + [166.454008, 45.406676], + [167.550615, 45.6314], + [168.655842, 45.845548], + [169.769396, 46.048961], + [170.89096, 46.241482], + [172.020195, 46.422959], + [173.15674, 46.59325], + [174.30021, 46.752216], + [175.4502, 46.899728], + [176.606286, 47.035662], + [177.768022, 47.159904], + [178.934945, 47.272349], + [180, 47.364262] + ], + [ + [-180, 47.364262], + [-179.893427, 47.372899], + [-178.71759, 47.461467], + [-177.538056, 47.537976], + [-176.355348, 47.602357], + [-175.170001, 47.654554], + [-173.982561, 47.69452], + [-172.793579, 47.722218], + [-171.603613, 47.737624], + [-170.413224, 47.740724], + [-169.222975, 47.731515], + [-168.033427, 47.710006], + [-166.845141, 47.676215], + [-165.658671, 47.630174], + [-164.474567, 47.571923], + [-163.293368, 47.501514], + [-162.115604, 47.419011], + [-160.941793, 47.324485], + [-159.772439, 47.21802], + [-158.608032, 47.099707], + [-157.449043, 46.969648], + [-156.295928, 46.827953], + [-155.149122, 46.67474], + [-154.00904, 46.510137], + [-152.876077, 46.334276], + [-151.750605, 46.147299], + [-150.632976, 45.949353], + [-149.523516, 45.740592], + [-148.422533, 45.521174], + [-147.330306, 45.291263], + [-146.247096, 45.051027], + [-145.173137, 44.800639], + [-144.108643, 44.540274], + [-143.053805, 44.270111], + [-142.00879, 43.990331], + [-140.973745, 43.701118], + [-139.948796, 43.402655], + [-138.934047, 43.09513], + [-137.929585, 42.778729], + [-136.935474, 42.45364], + [-135.951764, 42.120051], + [-134.978485, 41.778148], + [-134.015649, 41.428119], + [-133.063256, 41.070149], + [-132.121288, 40.704424], + [-131.189715, 40.331126], + [-130.268491, 39.950439], + [-129.35756, 39.562541], + [-128.456854, 39.167612], + [-127.566293, 38.765827], + [-126.685788, 38.357361], + [-125.815241, 37.942384], + [-124.954544, 37.521066], + [-124.103583, 37.093573], + [-123.262237, 36.660068], + [-122.430376, 36.220712], + [-121.607867, 35.775664], + [-120.794571, 35.325078], + [-119.990344, 34.869106], + [-119.195037, 34.407898], + [-118.4085, 33.9416] + ] + ] + }, + "properties": {} + }, + { + "type": "Feature", + "properties": { + "name": "Tokyo" + }, + "geometry": { + "type": "Point", + "coordinates": [139.7798, 35.5494] + } + }, + { + "type": "Feature", + "properties": { + "name": "Los Angeles" + }, + "geometry": { + "type": "Point", + "coordinates": [-118.4085, 33.9416] + } + } + ] +} diff --git a/packages/turf-great-circle/test/out/basic.geojson b/packages/turf-great-circle/test/out/basic.geojson index 0044c05a27..a2bed1eb03 100644 --- a/packages/turf-great-circle/test/out/basic.geojson +++ b/packages/turf-great-circle/test/out/basic.geojson @@ -2,6 +2,7 @@ "type": "FeatureCollection", "features": [ { + "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ @@ -107,7 +108,6 @@ [28.125, 43.325178] ] }, - "type": "Feature", "properties": {} }, { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f18631ed41..e393ba51e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3000,8 +3000,8 @@ importers: specifier: ^7946.0.10 version: 7946.0.14 arc: - specifier: ^0.2.0 - version: 0.2.0 + specifier: ^1.0.0 + version: 1.0.0 tslib: specifier: ^2.8.1 version: 2.8.1 @@ -7185,6 +7185,7 @@ packages: '@lerna/create@9.0.3': resolution: {integrity: sha512-hUTEWrR8zH+/Z3bp/R1aLm6DW8vB/BB7KH7Yeg4fMfrvSwxegiLVW9uJFAzWkK4mzEagmj/Dti85Yg9MN13t0g==} engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0} + deprecated: This package is an implementation detail of Lerna and is no longer published separately. '@ljharb/resumer@0.1.3': resolution: {integrity: sha512-d+tsDgfkj9X5QTriqM4lKesCkMMJC3IrbPKHvayP00ELx2axdXvDfWkqjxrLXIzGcQzmj7VAUT1wopqARTvafw==} @@ -7961,9 +7962,9 @@ packages: aproba@2.0.0: resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} - arc@0.2.0: - resolution: {integrity: sha512-8NFOo126uYKQJyXNSLY/jSklgfLQL+XWAcPXGo876JwEQ8nSOPXWNI3TV2jLZMN8QEw8uksJ1ZwS4npjBca8MA==} - engines: {node: '>=0.4.0'} + arc@1.0.0: + resolution: {integrity: sha512-Y1czl0GTrN/CAyZczn/kgZZ5EnOHLqLog2kdp/Cw00IDt1aq0UC5zdZQ5EjA0ucaqDc2F2AUs0dss9QUWnSc/w==} + engines: {node: '>=18'} argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} @@ -9058,6 +9059,7 @@ packages: git-raw-commits@3.0.0: resolution: {integrity: sha512-b5OHmZ3vAgGrDn/X0kS+9qCfNKWe4K/jFnhwzVWWg0/k5eLa3060tZShrRg8Dja5kPc+YjS0Gc6y7cRr44Lpjw==} engines: {node: '>=14'} + deprecated: This package is no longer maintained. For the JavaScript API, please use @conventional-changelog/git-client instead. hasBin: true git-remote-origin-url@2.0.0: @@ -9067,6 +9069,7 @@ packages: git-semver-tags@5.0.1: resolution: {integrity: sha512-hIvOeZwRbQ+7YEUmCkHqo8FOLQZCEn18yevLHADlFPZY02KJGsu5FZt9YW/lybfK2uhWFI7Qg/07LekJiTv7iA==} engines: {node: '>=14'} + deprecated: This package is no longer maintained. For the JavaScript API, please use @conventional-changelog/git-client instead. hasBin: true git-up@7.0.0: @@ -11264,10 +11267,12 @@ packages: tar@6.2.1: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me tar@7.5.2: resolution: {integrity: sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg==} engines: {node: '>=18'} + deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me temp-dir@1.0.0: resolution: {integrity: sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ==} @@ -13780,7 +13785,7 @@ snapshots: aproba@2.0.0: {} - arc@0.2.0: {} + arc@1.0.0: {} argparse@1.0.10: dependencies: From 762db6c22f7b4dccfb59d6ad5be23ec08d7a7afd Mon Sep 17 00:00:00 2001 From: Thomas Hervey Date: Sun, 3 May 2026 20:34:33 -0700 Subject: [PATCH 2/2] fix(great-circle): add noExternal arc to CJS build --- tsup.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tsup.config.ts b/tsup.config.ts index 283f087732..873a6ab4ee 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -19,6 +19,7 @@ export default [ ...baseOptions, outDir: "dist/cjs", format: "cjs", + noExternal: ["arc"], // arc is ESM-only; inline for CJS consumers }), defineConfig({ ...baseOptions,