unkinkPolygon
Description
Takes a kinked polygon and returns a feature collection of polygons that have no kinks.
Uses simplepolygon internally.
Parameters
Name | Type | Description |
---|---|---|
geojson | FeatureCollection<Polygon | MultiPolygon> | Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon | polygons 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(...);