@turf/unkink-polygon v7.2.0 eliminates holes in polygons
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
The following Jest test calls unkink-polygon with a simple polygon consisting of a square with a square hole. This polygon has no kinks, so unkink should return the same feature back. Instead it returns two features, one being a polygon in the shape of the square but without any hole, and the other a square polygon in the shape of the hole.
import {polygon} from '@turf/helpers';
import unkinkPolygon from '@turf/unkink-polygon';
describe('@turf/unkink-polygon', () => {
it('should work unkinking a square with a hole', () => {
const feature = polygon([
[[20,20],[0,20],[0,0],[20,0],[20,20]],
[[15,15],[5,15],[5,5],[15,5],[15,15]]
]);
const result = unkinkPolygon(feature);
expect(result.features.length).toBe(1); // gets 2 features instead!
expect(result.features[0]).toEqual(feature); // expect fails!
});
});
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 at the @turf/unkink-polygon entry point and reproduce the supplied Jest case using a square with a square hole. Trace how the input feature is processed when it has no kinks. Done means the result contains one feature equal to the original polygon, including its hole.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100