turf unkink-polygon module
npm install @spatial/unkink-polygonTakes a kinked polygon and returns a feature collection of polygons that have no kinks.
Uses [simplepolygon][1] internally.
- geojson ([FeatureCollection][2] \| [Feature][3]<([Polygon][4] \| [MultiPolygon][5])>) GeoJSON Polygon or MultiPolygon
``javascript
var poly = turf.polygon([[[0, 0], [2, 0], [0, 2], [2, 2], [0, 0]]]);
var result = turf.unkinkPolygon(poly);
//addToMap
var addToMap = [poly, result]
`
Returns [FeatureCollection][2]<[Polygon][4]> Unkinked polygons
[1]: https://github.com/mclaeysb/simplepolygon
[2]: https://tools.ietf.org/html/rfc7946#section-3.3
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
[4]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[5]: https://tools.ietf.org/html/rfc7946#section-3.1.7
---
This module is part of the Turfjs project, an open source
module collection dedicated to geographic algorithms. It is maintained in the
Turfjs/turf repository, where you can create
PRs and issues.
Install this module individually:
`sh`
$ npm install @spatial/unkink-polygon
Or install the Turf module that includes it as a function:
`sh``
$ npm install @turf/turf