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 | Feature<Polygon | MultiPolygon> | GeoJSON Polygon or MultiPolygon |
Returns
FeatureCollection<Polygon> Unkinked polygons
Examples
var poly = turf.polygon([
[
[0, 0],
[2, 0],
[0, 2],
[2, 2],
[0, 0],
],
]);
var 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(...);