3836 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
5a261c982f
Automatically add any inferred README changes in pre-commit hook (#2987) 2026-01-01 10:18:16 -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
7aaae1795b
Enforce only eraseable TypeScript syntax (#2977) 2025-12-18 07:41:31 -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
James Beard
4fa5c7dc2b
Preparing for NPM trusted publishing plus node version housekeeping (#2952)
* Added id-token permission to allow for migration to npm trusted
publishing. Updating node versions to reflect support matrix.
* Renamed turf.yml more descriptively to ci.yml
2025-12-10 09:51:03 +11: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
mfedderly
b43a4d51e8
Upgrade Lerna (#2964)
* Upgrade Lerna

* pnpm lerna repair

---------

Co-authored-by: James Beard <james@smallsaucepan.com>
2025-12-06 09:57:58 -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
21c78df131
Merge pull request #2963 from Turfjs/releases/7.3.1
Merge v7.3.1 release changes back to main branch
2025-11-27 22:45:56 +11:00
James Beard
b7f1b4eafb v7.3.1 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
9c2d283ce3
Transitive dependency updates (#2959)
* Remove unused marchingsquares dep in lockfile

* Bump serialize-javascript to 6.0.2

* Upgrade form-data to 4.0.5

* Bump cross-spawn to 6.0.6

* Bump axios to 1.13.2

* Upgrade glob@10 to 10.5.0

* Upgrade glob@11 to 11.1.0

* js-yaml@3 to 3.14.2

* js-yaml@4 to 4.1.1

* tmp@0.2 to 0.2.5

* brace-expansion@1 to 1.1.12

* brace-expansion@2 to 2.0.2
2025-11-22 20:10:37 -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
d2b0704a7e
Merge pull request #2953 from Turfjs/releases/7.3.0
Merge v7.3.0 release changes back to main branch
2025-11-17 21:32:39 +11:00
James Beard
9f58a103e8 v7.3.0 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
James Beard
e352195aa1
Merge pull request #2942 from ziegler-daniel/bugfix/issue-2941
@turf/shortest-path Allow polygon feature as obstacle for shortestPath (#2941)
2025-11-08 11:20:00 +11:00
James Beard
f3fce80c4e
Merge branch 'master' into bugfix/issue-2941 2025-11-08 10:58:31 +11:00
James Beard
e09b4dfb8b
Merge pull request #2936 from sargunv/patch-1
Add Kotlin Multiplatform port information to SEE_ALSO.md
2025-11-07 19:33:47 +11:00
James Beard
2608c67b06
Merge branch 'master' into patch-1 2025-11-07 18:47:52 +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
Sargun Vohra
623932e074
Add Kotlin Multiplatform port information to SEE_ALSO.md
Added Kotlin Multiplatform as a port for Turf with a link to the current to-do list for porting.
2025-10-03 18:05:29 -07: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
mfedderly
498f772bd0
Bump eslint dependencies (#2923) 2025-08-30 14:24:18 -04:00
James Beard
05494d856f
Merge pull request #2460 from hanneshdc/issue-1232
Changed lineSplit to use bbox from geojson-rbush rather than buggy turf-square
2025-05-25 13:58:18 +10: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
519d66edd7
Merge pull request #2724 from luc-tielen/master
Added missing layer in map example for @turf/line-split docs
2025-05-25 00:02:51 +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