unkinkPolygon does not handle polygons with interior holes

Open
#1,719 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
data

Research direction

Start at the turf.unkinkPolygon() entry point and reproduce the issue with the linked holeyFeatureCollection input and output. Trace how interior rings are classified; done means polygons with holes retain those holes rather than emitting them as separate exterior polygons.

Written by the indexing model from the issue text.

Description

@turf/unkink-polygon bug

When using turf.unkinkPolygon() on a polygon with interior rings, it appears to ignore those interior rings and treat them as exterior rings of an additional polygon. So for instance, if I feed in a FeatureCollection called holeyFeatureCollection to `unkinkPolygon(holeyFeatureCollection) which looks like this:
image

this is what the function spits out:
image

Also as additional info, if I feed in just the single Feature with the holey polygon, or just the Polygon, the result is the same FeatureCollection as output.

Input: https://gist.github.com/chrisbrainerd/05bfae9c2b6420c69692c90877a9e1c2
Output: https://gist.github.com/chrisbrainerd/08e5ad1e401023ffdc48bf7d2fbb11bc

Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Turfjs/turf

All issues in Turfjs/turf

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.