turf icon indicating copy to clipboard operation
turf copied to clipboard

turf.intersect throws RangeError on specific polygon inputs

Open manufont opened this issue 5 years ago • 1 comments

Hi! I get a RangeError: Maximum call stack size exceeded error using turf.intersect on specific polygon inputs. related jsfiddle

Here's the full code:

const intersect = require("@turf/intersect").default;

const polyA = {
  type: "Feature",
  properties: {},
  geometry: {
    type: "Polygon",
    coordinates: [
      [
        [-0.88207681, 44.58413909],
        [-0.88130621, 44.58321563],
        [-0.88122179, 44.58326259],
        [-0.88130422, 44.58334613],
        [-0.88207681, 44.58413909],
      ],
    ],
  },
};

const polyB = {
  type: "Feature",
  properties: {},
  geometry: {
    type: "Polygon",
    coordinates: [
      [
        [-0.8819363454438044, 44.58399492197494],
        [-0.881814, 44.583891],
        [-0.8818146977682092, 44.58387006695372],
        [-0.881562, 44.583887],
        [-0.8819363454438044, 44.58399492197494],
      ],
    ],
  },
};

intersect(polyA, polyB); // throws RangeError

manufont avatar Jan 22 '21 14:01 manufont

We get the same error with union as well

bryantqo avatar Feb 08 '22 14:02 bryantqo