turf-polygonize throws when otherwise valid geojson produces no valid polygons
Open
Nobody has claimed this yet.
@turf/polygonize
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
- version 6.5
- can't share the data
- no snippet.
Confirming this issue
Error: Each LinearRing of a Polygon must have 4 or more Positions.
polygon index.js:227
toPolygon EdgeRing.js:137
getEnvelope EdgeRing.js:148
findEdgeRingContaining EdgeRing.js:162
findEdgeRingContaining EdgeRing.js:161
polygonize index.js:41
polygonize index.js:40
I haven't deeply investigated but I wouldn't be surprised if the incoming data is a bit defective.
The biggest problem is that an exception is thrown, which means no polygons at all are returned.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the polygonize call path shown in index.js and EdgeRing.js, focusing on how a LinearRing with fewer than four positions is reached. Find or construct a reproducible GeoJSON case that produces no valid polygons, then verify that the operation no longer throws and that any valid polygons are still returned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100