Open fheldtm opened 2 weeks ago
Thanks for reporting this @fheldtm and tracking down where the problem is occurring. This is a known issue with the polygon-clipping library. We have an item our backlog to replace that library entirely, though can't provide an ETA.
Another way forward would be for polygon-clipping to fix this bug. Have you tried raising this issue with them?
Thank you for your response. I haven't tried raising the issue on the polygon-clipping side, I'll take it up with them.
Thanks @fheldtm. Will leave this issue open, and if we get the library replaced before they fix the bug, will tag you.
Version Information
Description
When using
turf.intersect
with specific polygon and multipolygon inputs, the function enters an infinite loop. This issue occurs with Turf.js version 7.1.0 and appears to be related to thepolygon-clipping.cjs.js
library used within Turf.js.Steps to Reproduce
The issue can be observed with the following code:
You can see a demonstration of the issue and further details via this JSFiddle.
The function enters an infinite loop. Debugging suggests that the issue arises in the
polygon-clipping.cjs.js
library, specifically in theoperation.run
, withinsweepLine.process
.The following code snippet from
polygon-clipping.cjs.js
seems to be where the problem originates:In this code,
prevSeg
becomes undefined, causing an infinite loop.