turf icon indicating copy to clipboard operation
turf copied to clipboard

booleanContains problem in isLineInPoly

Open ubaltaci opened this issue 7 years ago • 4 comments

Example data & snippet:

Poly.geojson Linestring.geojson

JSfiddle

Even though linestring is not completely contained by polygon, booleanContains function returns true.

It looks like isLineInPoly function only tests midpoints of line segments,

Did I miss something ?

ubaltaci avatar Jul 27 '18 01:07 ubaltaci

Hey @ubaltaci looks like you're right. Strange enough a simple test like this is actually missing in the package. Thanks for the heads-up.

stebogit avatar Jul 27 '18 01:07 stebogit

I just ran into this issue. It's not only just testing midpoints that is a problem, but also if ANY of the mid points are within the polygon isLineInPoly returns true.

hudsonb avatar Apr 25 '19 17:04 hudsonb

this is affecting us too. Any chance we can get a fix before v7? image the light-blue and black lines are getting a true from booleanContains in v6.3.0

markcarroll avatar Feb 09 '21 19:02 markcarroll

https://jsfiddle.net/abdulmalik07/pbcyzg6j/26/

Abdul007Malik avatar Dec 20 '21 06:12 Abdul007Malik