chore: release v1.0.0 - ESM-only, analytical antimeridian splitting, fix antimeridian low npoints split#79
Conversation
…n splitting - Remove bHasBigDiff / dfMaxSmallDiffLong / dfDateLineOffset heuristic - Bisect for exact crossing fraction via interpolate() (50 iterations) - Insert [±180, lat*] boundary points; npoints ≤ 2 keeps current behavior - Fixes issue #75: low npoints (e.g. 10) no longer skips the split - Tighten test assertions: SPLIT_NPOINTS constant, directional ±180 checks
Addresses Copilot review comment — adds coords.length === 2 check to assertSplitAtAntimeridian to guard against false positives from 3+ segment splits.
- Routes 2-5 (antimeridian crossers): replace stale coordinate snapshots with semantic assertions (Feature type, properties pass-through, WKT contains two LINESTRING parts). Splitting correctness is owned by antimeridian.test.ts. - Southern hemisphere filter: switch to coordinate comparison (start.y < 0 || end.y < 0) and flatten MultiLineString coordinates before .some() to fix number[][][] vs number[][] traversal bug. - Add south-to-south antimeridian crossing coverage: Sydney ↔ Buenos Aires at npoints=10 and 100 in both directions. - Reformat antimeridian.test.ts to consistent 2-space indentation. - Add geographic place names to all routes for maintainer clarity.
The GDAL-ported dateline splitting heuristic was removed when the analytical bisection approach was introduced. No remaining code derives from GDAL, so delete GDAL-LICENSE.md, remove it from the package.json files list, drop the file-level attribution block in great-circle.ts, and remove the GDAL references from README.md.
test: add antimeridian splitting tests for low npoints values
Mark ArcOptions.offset as @deprecated no-op. Remove non-existent test:build / test:all scripts and CJS/UMD bundle references from DEVELOPING.md.
Strip { offset } from all Arc() call sites — the field is a no-op
since the GDAL heuristic was replaced. Keep the backwards-compat type
assertion in typescript.test.ts with an explanatory comment. Update
README Dateline Crossing section and remove the offset UI control from
index.html.
Arc() with no argument previously returned a 2-point LineString (the <= 2 fallback). A default of 100 produces a usable great circle arc out of the box, consistent with the library's intent.
Consolidates inline coordinate constants, route arrays, and test property helpers into a single source of truth. All test files now import from test/fixtures/routes.ts, eliminating duplication and making fixture coverage reviewable in one place.
Generates a GeoJSON FeatureCollection of all test fixtures using the library itself (actual great circle arcs, not straight lines). Documents usage in DEVELOPING.md.
…tion Quantifies the performance cost of the analytical antimeridian bisection vs the prior GDAL linear interpolation approach. Runnable via `node scripts/benchmark.mjs` after `npm run build`.
…ments - Extract 50-iteration bisection count into ANTIMERIDIAN_BISECTION_ITERATIONS constant - Add inline comments explaining each phase of the Arc() algorithm - Clean up comments across src/ for clarity and consistency - Add Thomas Hervey to contributors in package.json
docs: remove deprecated offset option and GDAL attribution
|
@springmeyer @jgravois this is the PR to release v1.0.0. Double check the CHANGELOG for me and let me know if you see any issues before I merge and npm publish. Thanks! |
jgravois
left a comment
There was a problem hiding this comment.
CIL for one nit.
overall, this looks great!
| #### 3. Generate the arc | ||
| ```js | ||
| const line = gc.Arc(100, { offset: 10 }); | ||
| const line = gc.Arc(100); |
There was a problem hiding this comment.
let's show an example with npoints omitted too and make it explicit directly below that the argument is now optional.
There was a problem hiding this comment.
Good suggestion. In commit f2a3623 I've updated the README to show examples with and without npoints
jgravois
left a comment
There was a problem hiding this comment.
CIL for a few notes. nothing blocking imo.
| Arc(npoints: number = 100, _options?: ArcOptions): Arc { | ||
| // NOTE: With npoints ≤ 2, no antimeridian splitting is performed. | ||
| // A 2-point antimeridian route returns a single LineString spanning ±180°. Renderers that support coordinate wrapping (e.g. MapLibre GL JS) handle this correctly, whereas splitting would produce two disconnected straight-line stubs with no great-circle curvature — arguably worse behavior. This is a known limitation; open for maintainer discussion if a MultiLineString split is preferred. | ||
| if (!npoints || npoints <= 2) { |
There was a problem hiding this comment.
just another nit, but is there still value in trapping for !npoints now that we're setting a default value?
There was a problem hiding this comment.
Good point, !npoints can be safely removed. I'll do this in the next commit.
| { | ||
| "name": "arc", | ||
| "version": "0.2.0", | ||
| "version": "1.0.0", |
There was a problem hiding this comment.
just a note that we need to add src/ to the files array before we publish. doesn't matter to me whether that happens here or a follow-up PR.
when we do that, we should update the DEVELOPING.md file too.
ref: #80
There was a problem hiding this comment.
Yeah, let's roll this into the release, so I'll make those changes in the next commit.
| "LICENSE.md", | ||
| "GDAL-LICENSE.md", | ||
| "CHANGELOG.md" | ||
| "CHANGELOG.md" |
There was a problem hiding this comment.
i know you mentioned adding a new linter/formatter. in the meantime, the whitespace here is a bit borked.
- Remove redundant `!npoints` check now that default is 100 - Add src/ to package.json files array and update DEVELOPING.md - Fix Browser ESM example: arc.GreatCircle -> GreatCircle, Arc(100) -> Arc() - Fix CHANGELOG.md indentation in package.json files array
|
@springmeyer this is merged to |
|
i can publish this time around. |
|
published as nice work @thomas-hervey! |
|
Awesome. I'll work on pulling this into turf js soon. |
|
@jgravois sorry to bother you, but I'd like your quick input on re-adding CommonJS support (perhaps in a v1.0.1?). Before I work on re-adding CommonJS support in arc.js, I'm wondering if you have any alternative suggestions. Per this comment on my PR to resolve Turfjs/turf#3030 in TurfJS, a V8 only release is a ways off, so removing CommonJS support will be a breaking change. |
how so? since turf is publishing both ESM and CJS bundles for consumers and arc.js is a dependency, i'd expect the compiled output for the CJS build to include a CJS copy of arc.js. is that not the case? edit: i poked around for a few minutes and now i can see that one option would be for turf to use something like tsdown to bundle its own TS and dependency code together for the CJS build. not sure if the project has the appetite to switch, but i have to imagine that the DX would be better for it to bundle and that kdbush isn't the only other ESM project that it would be helpful for it to be able to support natively going forward. 🤔 |
|
Thinking... I don't feel too strongly, and I want to keep our momentum towards ESM, but still need to fix the target issue. I can ask but I suspect that they'd wait to make a change to their bundler later on, not for a fix like we're targeting. At that point, maybe it's worth waiting for a TurfJS V8 release. For now, it would be going back on our plan, but to resolve this issue I'm thinking that we could re-add a dual CJS/ESM build via |
|
if the turf folks are amenable to tweaking their own build my preference would be to stay ESM only on the 1.x branch. another way to buy time while we figure out the mechanics of ☝️ would be to publish a CJS compatible that said, this isn't my project and i'm not philosophically opposed to bundling CJS. i just think that it would be a genuine improvement if turf could also depend on kdbush without going 'all in' on ESM themselves. ps. looks like tsup isn't actively maintained anymore. |
No description provided.