Skip to main content
Version: Next

unkinkPolygon

Description

Takes a kinked polygon and returns a feature collection of polygons that have no kinks.

Uses simplepolygon internally.

Parameters

NameTypeDescription
geojsonFeatureCollection<Polygon | MultiPolygon> | Feature<Polygon | MultiPolygon> | Polygon | MultiPolygonpolygons to unkink

Returns

FeatureCollection<Polygon> Unkinked polygons

Examples

const poly = turf.polygon([
[
[0, 0],
[2, 0],
[0, 2],
[2, 2],
[0, 0],
],
]);

const result = turf.unkinkPolygon(poly);

Installation

$ npm install @turf/unkink-polygon

import { unkinkPolygon } from "@turf/unkink-polygon";
const result = unkinkPolygon(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.unkinkPolygon(...);