# @turf/polygonize ## polygonize Polygonizes [(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. **Parameters** - `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](http://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues. ### Installation Install this module individually: ```sh $ npm install @turf/polygonize ``` Or install the Turf module that includes it as a function: ```sh $ npm install @turf/turf ```