NYCPlanning / labs-applicantmaps

5 stars 5 forks source link

Turf intersect error when editing Underlying Zoning #588

Open andycochran opened 4 years ago

andycochran commented 4 years ago

Underlying Zoning cannot be edited for this project: https://applicantmaps.planning.nyc.gov/projects/C48PON7tgR%2FJJxfH5XFe/

When attempting to proceed, you. get the following error:

Error: Each LinearRing of a Polygon must have 4 or more Positions.

I managed to discover that there are 2 specific polygons that are preventing the editing of the others. When those two are removed, you can edit the others and proceed.

You can see the culprit polygons have been deleted in the project. To reproduce this issue, just reset the Underlying Zoning and try to proceed.

image

I assume this is an issue with Turf, because I've found the error in its code: https://github.com/Turfjs/turf/blob/c863c6abfb71a00c4e1d123f8178d026059f4f6e/packages/turf-helpers/index.ts#L254