-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@turf/intersect Error in v6.3.0: Unable to complete output ring #2048
Comments
I also encountered the same issue, and also found that I think I have a simpler case, and also a bit different, that might be helpful: Changing either points to match the other will resolve the error: const poly1 = polygon([
[
[973.2050807568878, 709.8076211353313],
[923.2050807568877, 623.2050807568874], /* <- change to 623.2050807568876 */
[923.2050807568877, 623.2050807568874],
[973.2050807568877, 536.6025403784436],
[973.2050807568877, 536.6025403784436],
[1073.2050807568876, 536.6025403784436],
[1073.2050807568876, 536.6025403784436],
[1123.2050807568878, 623.2050807568874],
[1123.2050807568878, 623.2050807568874],
[1073.2050807568878, 709.8076211353313],
[1073.2050807568878, 709.8076211353313],
[973.2050807568878, 709.8076211353313],
],
]);
const poly2 = polygon([
[
[1009.8076211353315, 573.2050807568876],
[923.2050807568877, 623.2050807568876], /* <- change to 623.2050807568874 */
[923.2050807568877, 623.2050807568876],
[873.2050807568877, 536.6025403784438],
[873.2050807568877, 536.6025403784438],
[959.8076211353315, 486.60254037844373],
[959.8076211353315, 486.60254037844373],
[1009.8076211353315, 573.2050807568876],
],
]);
var intersection = intersect(poly1, poly2); |
const poly1 = { const poly2 = { console.log(turf.intersect(poly1, poly2)) // return null i have same problem!! |
I am having a similar issue with the difference function (same error thrown, difference between polygon and Multipolygon contained within it) |
change feature coordinates with transformRotate or buffer , use function and return result to orginal coordinates |
finally i found solution! just fix coordinates to 8~10 decimals |
@thisismhp how did you do that? What exactly did you do? |
This seems like it could be closed as a dupe of #2277 (although that ticket is actually newer). The fix proposed there is for Turf.js to replace You could try bypassing Turf.js for now and calling polyclip-ts directly. |
Any updates? |
I recently ran into the problem as well. I followed the advice to fix the coordinates to 8 decimals of precision. Here is some code:
|
@pelord @jcapogna the open source team is short-staffed but seems open to the proposed fix to replace polygon-clipping library with the polyclip-ts. Right now, a volunteer to complete that would be welcome, or some dev could be hired to do it. A workaround is to structure your code such that polyclip-ts is used directly, bypassing the part of Turf that would call the polygon-clipping library. |
There's been some discussion recently about reviving the effort to get this fixed in Turf: luizbarboza/polyclip-ts#7 |
Hi,
After updating Turf from version 5.6.1 to 6.3.0, I am facing an error when trying to find the intersection between these two polygons using @turf/intersect (find geojson definition in https://gist.github.com/mortvif/07e100eae623d6816b53e3bc9cccf91d):
On version 5.6.1, the intersection was returned as expected:
However, on version 6.3.0, the following error appears instead:
Code to reproduce bug:
The text was updated successfully, but these errors were encountered: