Skip to content
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(poly1, poly2) crashes with an OOME #2833

Open
rogup opened this issue Feb 5, 2025 · 0 comments
Open

turf.intersect(poly1, poly2) crashes with an OOME #2833

rogup opened this issue Feb 5, 2025 · 0 comments

Comments

@rogup
Copy link

rogup commented Feb 5, 2025

Running this code on v7.2.0 hangs and eventually ends in a OOME

import * as turf from '@turf/turf';
const poly1coords = [
  [-2.232359, 53.349714],
  [-2.23244, 53.349848],
  [-2.232526, 53.349986],
  [-2.23262, 53.350125],
  [-2.232699, 53.350257],
  [-2.232757, 53.350349],
  [-2.232762, 53.350357],
  [-2.232771, 53.350365],
  [-2.232777, 53.350369],
  [-2.232784, 53.350372],
  [-2.23279, 53.350374],
  [-2.232837, 53.350365],
  [-2.232833, 53.35036],
  [-2.232802, 53.350318],
  [-2.232359, 53.349714],
];
const poly2coords = [
  [-2.232359, 53.349714],
  [-2.23244, 53.349848],
  [-2.232526, 53.349986],
  [-2.23262, 53.350125],
  [-2.232699, 53.350257],
  [-2.232757, 53.350349],
  [-2.232762, 53.350357],
  [-2.232771, 53.350365],
  [-2.232777, 53.350369],
  [-2.232784, 53.350372],
  [-2.23279, 53.350374],
  [-2.232834, 53.350366],
  [-2.23283, 53.350359],
  [-2.232808, 53.350326],
  [-2.23281, 53.350329],
  [-2.232802, 53.350318],
  [-2.232359, 53.349714],
];

const poly1 = turf.polygon([poly1coords]);
const poly2 = turf.polygon([poly2coords]);

const intersection = turf.intersect(turf.featureCollection([poly1, poly2]));

The polygons are thin strips of land, almost entirely overlapping apart from the top-left corner:

Image

I've tried running this in different environments (in a Node app, on a browser) and it hits the same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant