turf polygonize module
npm install @spatial/polygonizePolygonizes [(Multi)LineString(s)][1] into [Polygons][2].
Implementation of GEOSPolygonize function (geos::operation::polygonize::Polygonizer).
Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly
noded, i.e., they must only meet at their endpoints.
The implementation correctly handles:
- Dangles: edges which have one or both ends which are not incident on another edge endpoint.
- Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.
- geoJson ([FeatureCollection][3] \| [Geometry][4] \| [Feature][5]<([LineString][6] \| [MultiLineString][7])>) Lines in order to polygonize
- Throws [Error][8] if geoJson is invalid.
Returns [FeatureCollection][3]<[Polygon][9]> Polygons created
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[2]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[3]: https://tools.ietf.org/html/rfc7946#section-3.3
[4]: https://tools.ietf.org/html/rfc7946#section-3.1
[5]: https://tools.ietf.org/html/rfc7946#section-3.2
[6]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.5
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
[9]: https://tools.ietf.org/html/rfc7946#section-3.1.6
---
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/polygonize
Or install the Turf module that includes it as a function:
`sh``
$ npm install @turf/turf