@@ -140,25 +140,33 @@ function isPointInMultiPolygon(multiPolygon: MultiPolygon, point: Point) {
140140 * @private
141141 * @param {MultiPolygon } multiPolygon MultiPolygon geometry
142142 * @param {MultiPoint } multiPoint MultiPoint geometry
143- * @returns {boolean } true if every point is inside the interior of some polygon in the MultiPolygon
143+ * @returns {boolean } true if every point is inside some polygon in the MultiPolygon (boundary OK) and at least one is strictly interior
144144 */
145145function isMultiPointInMultiPolygon (
146146 multiPolygon : MultiPolygon ,
147147 multiPoint : MultiPoint
148148) {
149+ let oneInside = false ;
149150 for ( const coord of multiPoint . coordinates ) {
151+ // Check if point is inside any polygon (boundary OK)
150152 const pointInside = multiPolygon . coordinates . some ( ( polyCoords ) =>
151- booleanPointInPolygon (
152- coord ,
153- { type : "Polygon" , coordinates : polyCoords } ,
154- { ignoreBoundary : true }
155- )
153+ booleanPointInPolygon ( coord , { type : "Polygon" , coordinates : polyCoords } )
156154 ) ;
157155 if ( ! pointInside ) {
158156 return false ;
159157 }
158+ // Track if at least one point is strictly in the interior
159+ if ( ! oneInside ) {
160+ oneInside = multiPolygon . coordinates . some ( ( polyCoords ) =>
161+ booleanPointInPolygon (
162+ coord ,
163+ { type : "Polygon" , coordinates : polyCoords } ,
164+ { ignoreBoundary : true }
165+ )
166+ ) ;
167+ }
160168 }
161- return true ;
169+ return oneInside ;
162170}
163171
164172/**
@@ -284,12 +292,21 @@ function isMultiPointOnLine(lineString: LineString, multiPoint: MultiPoint) {
284292}
285293
286294function isMultiPointInPoly ( polygon : Polygon , multiPoint : MultiPoint ) {
295+ let oneInside = false ;
287296 for ( const coord of multiPoint . coordinates ) {
288- if ( ! booleanPointInPolygon ( coord , polygon , { ignoreBoundary : true } ) ) {
297+ // All points must be inside polygon (boundary OK)
298+ if ( ! booleanPointInPolygon ( coord , polygon ) ) {
289299 return false ;
290300 }
301+ // Track if at least one point is strictly in the interior
302+ if ( ! oneInside ) {
303+ oneInside = booleanPointInPolygon ( coord , polygon , {
304+ ignoreBoundary : true ,
305+ } ) ;
306+ }
291307 }
292- return true ;
308+ // At least one point must be in the interior (not just on boundary)
309+ return oneInside ;
293310}
294311
295312function isLineOnLine ( lineString1 : LineString , lineString2 : LineString ) {
0 commit comments