geo-registry

Lines To Polygons

Polygons formed by closed lines, or by the areas that a network of lines encloses.

Pitfall. Some engines turn each closed line into a polygon; others build polygons from every area the lines enclose together, which differs when lines cross.
Pitfall. Lines that do not quite meet (an unsnapped gap) enclose nothing.
About this operation
Also called Feature To Polygon, polygonize lines, close rings
Group vector/geometry
Checks geometry.valid
Pitfalls 2 listed above
Columbus tool Not stated
Notes Not stated
Status active
Broader Not stated
Narrower Not stated
Related

Parameters

Not stated

Inputs and outputs

Direction Name Type Geometry Note
Input layer vector line Not stated
Output output vector polygon Not stated

In each engine

Engine Tool Parameters Differences
geopandas geopandas.GeoSeries.polygonize Not stated
  • Builds polygons from the areas the lines enclose together (noded first by default).
postgis st_polygonize
  • layer → #1
  • An aggregate; returns one GeometryCollection of the enclosed areas.
qgis qgis:linestopolygons
  • layer → INPUT
  • output → OUTPUT
  • Closes each line into its own polygon (native:polygonize instead builds polygons from the areas lines enclose together).
sf sf::st_polygonize
  • layer → x
  • Per feature; returns a GeometryCollection for each.
shapely shapely.polygonize
  • layer → geometries
  • Builds polygons from the areas the lines enclose together; returns one GeometryCollection.
turf-js turf.polygonize
  • layer → geoJson
  • Turf works on GeoJSON in longitude/latitude (WGS 84); data in another CRS must be reprojected first.
whiteboxtools LinesToPolygons
  • layer → input
  • output → output
None noted