Turfjs / turf

A modular geospatial engine written in JavaScript and TypeScript
https://turfjs.org/
MIT License
9.23k stars 937 forks source link

Defaulting to `ignoreSelfIntersections: false` changes behavior of a number of Turf methods in v7 #2722

Open pm0u opened 2 hours ago

pm0u commented 2 hours ago

Introduced in #2033

Defaulting to include self intersections in the @turf/line-intersect module has introduced breaking changes to a number of consuming modules as well as creating unexpected behaviors within those modules. Previously, I believe this algorithm did not / was not able to check for self intersections however now it does by default.

Examples

6.5.0 7.1.0 (includes sweepline module example)

Related issues

https://github.com/Turfjs/turf/issues/2707 https://github.com/Turfjs/turf/issues/2700 https://github.com/Turfjs/turf/issues/2633 https://github.com/Turfjs/turf/issues/2585

pm0u commented 2 hours ago

While booleanIntersects (and others) can be worked around by adding an explicit { ignoreSelfIntersections: true }, some methods such as booleanCrosses do not expose this option and do not explicitly exclude self intersections themselves essentially rendering them broken (I do not believe the intention of crosses would be that when comparing two geometries, return true if one of the geometries crosses itself)