Turfjs / turf

A modular geospatial engine written in JavaScript and TypeScript
https://turfjs.org/
MIT License
9.19k stars 934 forks source link

turf.voronoi report an error:Cannot read properties of null (reading '0') #2464

Open younggis opened 1 year ago

younggis commented 1 year ago

When I used turf.voronoi to generate Voronoi polygons, the following error occurred:

Uncaught TypeError: Cannot read properties of null (reading '0')
    at turf.min.js:80:68643
    at new Ra (turf.min.js:80:69303)
    at r (turf.min.js:88:412086)
    at r.polygons (turf.min.js:88:412247)
    at t.voronoi (turf.min.js:88:412923)
    at turf.html:174:30

this points will report an error.the problem is [119.33893, 25.731901] and [119.338931, 25.731901].Could you please see why the error was reported?thanks.

points:
[
    [119.365891, 26.049549],
    [119.360972, 25.731612],
    [119.335263, 25.724399],
    [119.345076, 25.703511],
    [119.33893, 25.731901],
    [119.338931, 25.731901]
]
bbox:
[118.69595817618412, 25.493916216401107, 119.41693595938725, 26.139962823065883]
JamesLMilner commented 1 year ago

Hey, thanks for raising your issue. In order to help diagnose the issue we'd need a the code/data for a minimal reproduction of the issue. You could use something like https://codesandbox.io/ to do this and share it here.

maral commented 8 months ago

My guess is that the last two points are considered as duplicates and the error is the result. It's difficult to guess where exactly the error appears, though.