3820 Commits

Author SHA1 Message Date
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
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
James Beard
60c861bbec
Merge pull request #2685 from Turfjs/mf/nx-cleanup
Updated nx config to make sure running tests for a specific package pick up source changes
2025-05-17 12:24:32 +10:00
James Beard
a8e0272b6a
Merge branch 'master' into mf/nx-cleanup 2025-05-17 11:27:50 +10:00
James Beard
faf58b3010
Merge pull request #2838 from conor-f/docs-full-units
Updated documentation to refer to Units type where appropriate, rather than string
2025-05-16 23:15:00 +10:00
conor-f
7501c18cd9
Makes units link to website docs. 2025-05-16 08:59:12 +02:00
James Beard
95e46b6e2a
Merge pull request #2884 from macrouch/master
Fixed antipodal error message in turf-great-circle to not generate an error itself
2025-05-16 09:24:21 +10:00
Matthew Crouch
2a110aea33 turf-great-circle: Fix antipodal error message 2025-05-15 07:02:14 -04:00
James Beard
11ec0a86fd
Merge pull request #2830 from smallsaucepan/simplify-infinite
Fixed simplify to not get stuck in an infinite loop on certain geometries
2025-05-15 20:03:45 +10:00
James Beard
ac72619a4b
Merge branch 'master' into simplify-infinite 2025-05-10 12:11:56 +10:00
James Beard
3a4cd44edf
Merge pull request #2879 from smallsaucepan/build-tools-update
Updated build tools - pnpm, lerna, typescript, tsup, etc housekeeping
2025-05-07 11:38:33 +10:00
James Beard
74c194ab56 Merge branch 'master' into build-tools-update 2025-05-04 21:53:40 +10:00
James Beard
915a3ebb93 Upgraded from pnpm 9 to 10. Small update required to eslint because pnpm no longer auto-hoists some packages (https://github.com/pnpm/pnpm/issues/8378). Solution to go through typescript-eslint instead to get to plugin and parser. 2025-05-04 21:50:49 +10:00
mfedderly
b321266374
Migrate from workspace:^ to workspace:* to pin dependency versions (#2878) 2025-05-03 14:03:24 -04:00
James Beard
5e223c5822 First step of updating pnpm from 8 to 9 using "corepack use pnpm@9". Going direct from 8 to 10 discarded the lockfile entirely leading to some dependencies upgrading slightly and causing build problems. Taking it in two steps should hopefully avoid this. 2025-05-02 20:39:41 +10:00
James Beard
3b8e7fe6ca
Merge pull request #2852 from prozvora/proz/fix-destination-coord
Changed turf-destination and turf-ellipse to pass through elevation value if present
2025-05-01 14:19:06 +10:00