@turf/polygonize
TypeScript icon, indicating that this package has built-in type declarations

7.0.0 • Public • Published

@turf/polygonize

polygonize

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

  • Throws Error if geoJson is invalid.

Returns FeatureCollection<Polygon> Polygons created


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.

Installation

Install this single module individually:

$ npm install @turf/polygonize

Or install the all-encompassing @turf/turf module that includes all modules as functions:

$ npm install @turf/turf

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @turf/polygonize

Weekly Downloads

365,010

Version

7.0.0

License

MIT

Unpacked Size

128 kB

Total Files

9

Last publish

Collaborators

  • smallsaucepan
  • morgan.herlocker
  • twelch
  • jamesmilneruk
  • rowanwins
  • tmcw
  • morganherlocker
  • tcql
  • mdfedderly