polygonize
Description
Polygonizes (Multi)LineString(s) into Polygons.
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
Name | Type | Description |
---|---|---|
geoJson | FeatureCollection | Geometry | Feature<LineString | MultiLineString> | Lines in order to polygonize |
Returns
FeatureCollection<Polygon> Polygons created
Installation
$ npm install @turf/polygonize
import { polygonize } from "@turf/polygonize";
const result = polygonize(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.polygonize(...);