@turf/difference: Maximum call stack size exceeded when using difference function between 2 polygons
KubiO24 opened this issue · comments
Jakub Kowal commented
I am getting following error:
RangeError: Maximum call stack size exceeded
image
When I use turf difference function between 2 polygons:
const pol1 = [
[
[49.93317115095019, 20.170898437500004],
[49.93927561914192, 20.16278743743897],
[49.941126142253154, 20.165448188781742],
[49.934096538617936, 20.174009799957275],
[49.93317115095019, 20.170898437500004],
],
];
const pol2 = [
[
[49.93317115095019, 20.170898437500004],
[49.933680058500165, 20.170222252607346],
[49.933758735535065, 20.170222252607346],
[49.933803934349285, 20.170152112841606],
[49.933803934349285, 20.170057658905122],
[49.934306839656294, 20.169389449185992],
[49.93434632011994, 20.16945071518421],
[49.93434632011994, 20.16959099471569],
[49.93448191656261, 20.16980141401291],
[49.93457231419105, 20.16980141401291],
[49.93466271181949, 20.16966113448143],
[49.93484350707638, 20.16966113448143],
[49.93520509759015, 20.169100016355515],
[49.93529549521859, 20.169100016355515],
[49.935928278617695, 20.168118059635166],
[49.936018676246135, 20.168118059635166],
[49.93660626083101, 20.167206242680553],
[49.93660626083101, 20.167065963149074],
[49.9367870560879, 20.166785404086117],
[49.9367870560879, 20.166645124554638],
[49.93714864660167, 20.166084006428722],
[49.93714864660167, 20.165613543475054],
[49.93742361679489, 20.16524819088677],
[49.93755543592966, 20.165452748537067],
[49.938504611028314, 20.16397981345654],
[49.938504611028314, 20.163811875057462],
[49.93927561914192, 20.16278743743897],
[49.941126142253154, 20.165448188781742],
[49.93988364085967, 20.16696147663808],
[49.93981537664073, 20.166855543851856],
[49.93958938256963, 20.167206242680553],
[49.93958938256963, 20.167319864563666],
[49.934096538617936, 20.174009799957275],
[49.93317115095019, 20.170898437500004],
],
];
let polygon1 = turf.polygon(pol1);
let polygon2 = turf.polygon(pol2);
polygon1 = turf.difference(polygon1, polygon2);
Here is visualization of these two polygons on map:
polygon 1
polygon 2
Turf version: 6.5.0.