@turf/kinks and @turf/unkink-polygon
See original GitHub issueThe 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);
...
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
turf-kinks - Find all self-intersections of a given Polygon - GitHub
Takes a Polygon|polygon and returns Point|points at all self-intersections. Parameters. parameter, type, description. polygon, Feature ...
Read more >@turf/kinks - npm
Start using @turf/kinks in your project by running `npm i @turf/kinks`. There are 33 other projects in the npm registry using @turf/kinks.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @DenisCarriere. I had to re-implement kink and unkinkPolygon functions in my own project because of this issue. It’s ES6 and a little brute-force but it does the job. Cheers!
https://gist.github.com/barnabas-avalara/2a9d9be5edd84fe2da8e769a9a9c509e
👍 @rowanwins Agreed, having both modules align would be the best approach using
geojson-polygon-self-intersections
, unfortunately that’s not a quick fix and would require some serious effort in making that modification.