From 3bc1f26a353e71f1c95f19c9d92db8d7a3d28ca9 Mon Sep 17 00:00:00 2001 From: greymoth-jp <246701683+greymoth-jp@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:33:04 +0900 Subject: [PATCH 1/2] fix(boolean-within): track interior point across all points in isMultiPointInPoly --- packages/turf-boolean-within/index.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/turf-boolean-within/index.ts b/packages/turf-boolean-within/index.ts index 900a1c93a..5da299ff0 100644 --- a/packages/turf-boolean-within/index.ts +++ b/packages/turf-boolean-within/index.ts @@ -139,22 +139,21 @@ function isMultiPointOnLine(multiPoint: MultiPoint, lineString: LineString) { } function isMultiPointInPoly(multiPoint: MultiPoint, polygon: Polygon) { - var output = true; var oneInside = false; - var isInside = false; for (var i = 0; i < multiPoint.coordinates.length; i++) { - isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon); - if (!isInside) { - output = false; - break; + // All points must be inside polygon (boundary OK) + if (!booleanPointInPolygon(multiPoint.coordinates[i], polygon)) { + return false; } + // Track if at least one point is strictly in the interior if (!oneInside) { - isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon, { + oneInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon, { ignoreBoundary: true, }); } } - return output && isInside; + // At least one point must be in the interior (not just on boundary) + return oneInside; } function isLineOnLine(lineString1: LineString, lineString2: LineString) { From 98de7dab395ee6bd0cc872124b6a25b220493c46 Mon Sep 17 00:00:00 2001 From: greymoth-jp <246701683+greymoth-jp@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:33:07 +0900 Subject: [PATCH 2/2] test(boolean-within): add MultiPoint interior+boundary within Polygon fixture --- ...MultiPointOneOnBoundaryOneInterior.geojson | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 packages/turf-boolean-within/test/true/MultiPoint/Polygon/MultiPointOneOnBoundaryOneInterior.geojson diff --git a/packages/turf-boolean-within/test/true/MultiPoint/Polygon/MultiPointOneOnBoundaryOneInterior.geojson b/packages/turf-boolean-within/test/true/MultiPoint/Polygon/MultiPointOneOnBoundaryOneInterior.geojson new file mode 100644 index 000000000..7fecae144 --- /dev/null +++ b/packages/turf-boolean-within/test/true/MultiPoint/Polygon/MultiPointOneOnBoundaryOneInterior.geojson @@ -0,0 +1,32 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [ + [0.5, 0.5], + [1, 1] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [0, 0], + [1, 0], + [1, 1], + [0, 1], + [0, 0] + ] + ] + } + } + ] +}