Turfjs / Turfjs/turf

@turf/kinks and @turf/unkink-polygon

Open
#1,094 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

@turf/kinks @turf/unkink-polygon bug
Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Description

The kinks package detects self-intersection in the following shape: https://gist.github.com/polizz/53bfb5d8cd0e7cac09ae6543e1c89528. When I run the shape through unkink-polygon, I get the same shape back out. Not sure what is wrong here. The unkink-polygon function does work on other self-intersecting polygons. Let me know if I can provide more information.

export function removeDuplicatesAndFormatGeoJson(wkt) {
  try {
    let cleanGeom = clean(parse(wkt));
    const hasKinks = get(kinks(cleanGeom), 'features[0].geometry', false);

    if (hasKinks) {
      const unkinked = unkink(cleanGeom);
...

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.

Research direction

Start by reproducing the supplied shape from the gist through the @turf/kinks and @turf/unkink-polygon entry points. Inspect how the two packages handle this self-intersection and compare it with the other self-intersecting polygons that already work; done means the supplied shape is correctly unkinked without regressing those cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.