-
Notifications
You must be signed in to change notification settings - Fork 992
Open
Labels
Description
This is basically a re-opening of:
As that was closed by the author without any fix 6 years ago.
unkinkPolygon throws an error The input polygon may not have duplicate vertices (except for the first and last vertex of each ring) when run on a polygon with duplicate vertices.
Reproduction using an hourglass shape, where the center has 2 stacked vertices:
const hourglass = turf.polygon( [[
[0,0],
[1,1], // center
[2,2],
[0,2],
[1,1], // center
[2,0],
[0,0]
]]);
// all of these error
turf.unkinkPolygon(hourglass)
turf.unkinkPolygon(turf.cleanCoords(hourglass))
turf.unkinkPolygon(turf.simplify(hourglass, {tolerance: 0.5}))
turf.unkinkPolygon(turf.simplify(hourglass, {tolerance: 0.5, highQuality: true}))