2407 Commits

Author SHA1 Message Date
Matthew Fedderly
2f579b31ad
Migrate @turf/buffer to TypeScript, ignoring errors 2026-01-05 08:52:57 -05:00
mfedderly
42bd068574
Clean up .js files in various TypeScript-first packages (#2992)
* Migrate isobands and isolines grid lib files

* simplifyjs

* great-circle already migrated to upstream arc npm package

* Migrate js files in unkink-polygon, this felt kinda rough

* Migrate astar lib to typescript

* Remove heuristic option to fix typings
2026-01-01 12:23:13 -07:00
mfedderly
31d519941d
@turf/geojson-rbush to TypeScript (#2980) 2025-12-31 13:42:02 -07:00
mfedderly
bc6e4150b3
Migrate @turf/line-split to TypeScript (#2985) 2025-12-31 13:28:56 -07:00
mfedderly
f11198418d
@turf/line-slice-along to TypeScript (#2978)
* @turf/line-slice-along to TypeScript

* Specify units option more robustly
2025-12-18 14:59:33 -05:00
mfedderly
eb9de6486c
@turf/line-slice to TypeScript (#2979) 2025-12-18 07:52:43 -05:00
mfedderly
9b1469d329
Migrate @turf/line-offset to TypeScript (#2974) 2025-12-17 08:13:33 -05:00
mfedderly
b6cdcd88dd
Move to Extract for @turf/helpers' geometry() (#2976) 2025-12-17 07:52:45 -05:00
mfedderly
9f01ae5e7e
Improve type inference in @turf/helpers' geometry and geometryCollection (#2971)
* Improve type inference in @turf/helpers' geometry and geometryCollection functions
2025-12-16 08:24:15 -05:00
mfedderly
259008aa30
Migrate @turf/line-chunk to TypeScript (#2969)
* Migrate @turf/line-chunk to TypeScript

* mrl and pnpm i
2025-12-14 19:43:15 -05:00
James Beard
6717ef5d70
Changed booleanCrosses with two input lines to recognise if crossing point is between vertices (#2968)
* Changed booleanCrosses to check potential intersection points at any point on the line. Previously was only checking against line vertices.
2025-12-15 07:54:05 +11:00
mfedderly
a954bf9c21
Migrate @turf/interpolate to TypeScript (#2966)
* Migrate @turf/interpolate to TypeScript

* Fix interpolate type signature for better inference
2025-12-14 06:46:01 -05:00
Emil Junker
536112d6af
Refactor and extend properties of returned nearest point in @turf/nearest-point-on-line (#2867)
* Compute multiFeatureLocation in addition to location property in @turf/nearest-point-on-line
* nearest-point-on-line Rename param pt to inputPoint
* nearest-point-on-line Rename point properties
* nearest-point-on-line Rename some internal variables
* nearest-point-on-line Mark old properties as deprecated
* nearest-point-on-line Update README

---------

Co-authored-by: James Beard <james@smallsaucepan.com>
2025-12-09 22:11:50 +11:00
Thomas Hervey
14f354ffca
Typescript-ifying turf-great-circle (#2733)
* Added typing to index.ts, tests to test.ts

* Update pnpm-lock.yaml after dependency updates

* Replace embedded arc.js with external TypeScript arc package

- Add arc@^0.2.0 (WIP bump) as dependency to replace embedded lib/arc.js
- Update import from './lib/arc.js' to 'arc' package
- Fix TypeScript type compatibility issues:
  - Handle null properties with fallback to empty object
  - Add proper type assertion for return value
- All tests pass (9/9) with new TypeScript arc.js integration
- Maintains 100% backward compatibility while adding full TypeScript support

* Remove arc.d.ts which is no longer needed, regenerate pnpm-lock

---------

Co-authored-by: mfedderly <24275386+mfedderly@users.noreply.github.com>
2025-12-08 08:47:38 -05:00
MartinP-C
5c4b040e21
@turf/boolean-contains - support for multipolygon inside polygon (#2357)
* add tests for multipolygon contained by polygon
* check for is every multipolygon inside polygon

---------

Co-authored-by: Martin Powlesland-Cook <mpowlesland-cook@denseair.net>
Co-authored-by: James Beard <james@smallsaucepan.com>
2025-12-06 14:50:42 +11:00
Samuel Arbibe
f615482691
turf-boolean-contains + turf-boolean-within: Fix line in polygon (#2848)
* fix boolean-contains and boolean-within isLineInPoly
* update esri-contains and esri-within diagrams
* check if line is contained in boundary after splitting on intersections
* fix line simply containes in polygon, and tidy up test examples
* split linestring segments on polygon before checking midpoints
* add explanatory comments and update docs

---------

Co-authored-by: samuelarbibe <samuel.arbibe@gmail.com>
Co-authored-by: James Beard <james@smallsaucepan.com>
2025-12-06 14:00:30 +11:00
James Beard
984b84c31d
Fixed bug where nearestPointOnLine would return an index to a non-existent segment (#2951)
This was having a flow on effect in lineSlice where an additional duplicate point would be
added as a result.
2025-12-06 00:17:39 +11:00
James Beard
b7f1b4eafb v7.3.1 2025-11-27 17:43:27 +11:00
mfedderly
5a34d08b07
Bump glob@11 package.json entries (#2961) 2025-11-23 05:58:22 -05:00
mfedderly
3cc76a2290
Remove npm-run-all in favor of pnpm regex script name functionality (#2960) 2025-11-22 20:23:41 -05:00
mfedderly
c04c67bb95
Clean up isobands output for empty bands (#2957)
- Bands that are above the highest data in the grid will no longer incorrectly emit a polygon that contains the entire grid

Fixes #2956
2025-11-21 20:37:58 -05:00
James Beard
9f58a103e8 v7.3.0 2025-11-17 20:08:41 +11:00
Angel Lacret
bac370a20a
@turf/nearest-point-on-line TESTS: add test for duplicated points on line string affecting v7.2.0 (#2903)
* TESTS: add test for duplicated points on line string affecting v7.2.0

---------

Co-authored-by: James Beard <james@smallsaucepan.com>
2025-11-15 19:42:21 +11:00
Brendan Ratter
736b1eff42
Fix @turf/nearest-point-on-line endpoint selection and degenerate input cases (#2940)
* @turf/nearest-point-on-line code simplifications

Before fixing behavioral bugs, making some non-behavior changing
cleanups:
- Removing unused distance calculations
- Cleaning up tuples and position variable use in main loop
- Removing unnecessary conditions and types for intersectPt (it will
  always exist)
- Added return type to magnitude function
- Reduced duplicate calculations in return values for
  nearestPointOnSegment

Fix @turf/nearest-point-on-line #2934 issue

Changed closest point determination logic to ensure that the correct
endpoint is returned in certain cases where the line segment spans more
than Pi radians.

Specific changes:
- Added normalize vector function
- Replaced inline coefficient calculations with existing vector
  functions for readability
- Added geometric rationale comments for intermediate steps
- Added minimal failing test for #2934
- Replaced closest intersection point logic with dot product version
- Replaced closest endpoint distance logic with dot product version
  (less calculations)

Fix @turf/nearest-point-on-line degenerate cases

Cross product usage leads to several degenerate edge cases that can
lead to spurious failures. This attempts to fix several of them:
- Clamp z-value before asin when converting to lng-lat
- Capture degenerate zero-vectors in the segment's normal from
  coincident or antipodal points
- Early return from coincident points as this becomes a pt-pt distance
- Explicit throw from antipodal points as an infinite number of arcs
  match
- Early return when the target is coincident with the segment's normal,
  here all points are equidistant so choose the endpoint for consistency

@turf/nearest-point-on-line improve test

Improve test addressing degenerate line segment cases. These tests were
failing in browser but succeeding in Chrome. This test fix monkey
patches Node to capture any regressions.

* Fix @turf nearest-point-on-line incorrect endpoints

Two additional fixes:
- Caught an additional failure case widely separated points could
  incorrectly return that the intersection point was inside the line
  segment; added regression test for this case
- Elminated throw on antipodal points, instead returning that the point
  lies directly on the line; added comment in function signature
  mentioning this behavior

* Fix: @turf/nearest-point-on-line failing test

After changes, tests in @turf/point-to-polygon-distance were failing.
Issue confirmed to be due to single bit floating point difference and
updated to new output value.

Also fixed partially missing comment.

* Fix: @turf/nearest-point-on-line faililng test

9edc247a introduced another floating point precision issue that is fixed
here.
2025-11-11 13:14:09 -05:00
Daniel Ziegler
ad10a65c56
@turf/shortest-path improve creation of point matrix for A* algorithm (#2943) (#2944)
* @turf/shortest-path improve creation of point matrix for A* algorithm (#2943)

* Use 6 decimal digits as precision for test data

---------

Co-authored-by: James Beard <james@smallsaucepan.com>
2025-11-10 22:30:01 +11:00
Laure-Hélène Bruneton
9edc247a0e
Fix issue 2824 on turf-point-to-polygon-distance (#2845)
* add non-passing test fixture

* make each step return correctly signed value

* call booleanPointInPolygon one less time

---------

Co-authored-by: James Beard <james@smallsaucepan.com>
2025-11-09 13:42:50 +11:00
mfedderly
8ccda4a83e
Rewrite @turf/isobands (#2926)
* Reimplement @turf/isobands to clear up licensing issues around marchingsquares

* Add test case from issue #1084

---------

Co-authored-by: James Beard <james@smallsaucepan.com>
2025-11-08 19:44:47 +11:00
mfedderly
f4dea9ca0d
Rewrite @turf/isolines (#2918)
* Reimplement @turf/isolines to clear up the licensing concerns around marchingsquares.

---------

Co-authored-by: James Beard <james@smallsaucepan.com>
2025-11-08 14:54:10 +11:00
Daniel Ziegler
be93248398
issue-2941 - Allow polygon feature as obstacle for shortestPath 2025-11-03 18:36:54 +01:00
mfedderly
94432b9ab7
Use newer @types/rbush that fixes the need for the reexport shims (#2924) 2025-10-23 09:48:49 -04:00
mfedderly
3c31d5e87a
@turf/isobands and @turf/isolines check pointGrid input is actually gridded already (#2927)
* @turf/isobands and @turf/isolines check pointGrid input is actually gridded already

* Upgrade docs wording about the gridding requirement
2025-08-31 13:31:08 -04:00
mfedderly
2dcf7ddac8
Fix @turf/isobands issue with ring nesting logic (#2925)
Co-authored-by: James Beard <james@smallsaucepan.com>
2025-08-31 06:20:20 -04:00
James Beard
4b15924bfd Minor prettify fixes to a couple of geojson test fixtures flagged by the linter. 2025-05-25 13:37:36 +10:00
James Beard
f23709c106
Merge branch 'master' into issue-1232 2025-05-25 00:07:33 +10:00
James Beard
c8865e6cd2 No longer need to reference @turf/square. Added tests for examples mentioned in issue #1232, as well as #2288 which this PR also helps address. Tidied up some test file Typescript errors. 2025-05-24 23:59:54 +10:00
James Beard
f27b58ed38
Merge branch 'master' into issue-1232 2025-05-24 21:25:57 +10:00
James Beard
08aba00a56
Merge branch 'master' into master 2025-05-23 23:32:53 +10:00
conor-f
7501c18cd9
Makes units link to website docs. 2025-05-16 08:59:12 +02:00
Matthew Crouch
2a110aea33 turf-great-circle: Fix antipodal error message 2025-05-15 07:02:14 -04:00
James Beard
ac72619a4b
Merge branch 'master' into simplify-infinite 2025-05-10 12:11:56 +10:00
James Beard
74c194ab56 Merge branch 'master' into build-tools-update 2025-05-04 21:53:40 +10:00
mfedderly
b321266374
Migrate from workspace:^ to workspace:* to pin dependency versions (#2878) 2025-05-03 14:03:24 -04:00
James Beard
3e7c7a8941
Merge branch 'master' into proz/fix-destination-coord 2025-05-01 12:50:37 +10:00
James Beard
fe3492acbd Updated other dev dependencies such as es-check, write-json-file, rollup, and babel. 2025-04-30 21:09:52 +10:00
James Beard
b8d4d7ed81 Intermediate commit right after pnpm interactive update and a monorepolint run to bring package versions into line with root level updates. Most significant being tsup, tsx, and typescript. Some types tests now failing though. 2025-04-30 17:09:24 +10:00
Emil Junker
326a96a650
turf-nearest-point: maintain point properties in result type (#2866) 2025-04-08 14:36:43 -07:00
Jens Theisen
b53f6d1b02
Add warning about shape distortion #217 (#2831)
Co-authored-by: Tim Welch <tim.j.welch@gmail.com>
2025-04-06 07:22:40 -07:00
insideGen
a5c5ed8cc4
turf-nearest-point-on-line: Fix issue #2808 add support for redundant coordinates in line (#2849)
* turf-nearest-point-on-line: Fix issue #2808

Add a short circuit if the start position is equal to the stop position to avoid the “Error: coordinates must contain numbers” problem.

* add test

* clean up test

---------

Co-authored-by: Tim Welch <tim.j.welch@gmail.com>
2025-04-05 21:32:15 -07:00
Pavel Rozvora
41d17d03b7
Merge branch 'master' into proz/fix-destination-coord 2025-03-21 10:17:33 -04:00
Simon Andersson
212d166436
turf-hexgrid: fix issue #2841 (#2856)
* turf-hexgrid: fix issue #2841

Typing of mask does not allow for MultiPolygon while the documentation obviously states that this is allowed

* feat: update readme of turf-hexgrid to include MultiPolygon
2025-03-17 08:02:28 -07:00