geo-registry

Raster To Polygons

Turns areas of connected cells with the same value into polygons, each carrying that value.

Pitfall. Continuous rasters (elevation, imagery) give one polygon per cell or tiny group of cells; classify or round values first.
Pitfall. Engines differ on floating-point values; some truncate them to integers first.
About this operation
Also called Polygonize, Raster To Polygon, raster to vector, vectorize
Group conversion/raster-to-vector
Checks raster.nodata, geometry.valid
Pitfalls 2 listed above
Columbus tool Not stated
Notes Not stated
Status active
Broader Not stated
Narrower Not stated
Related

Parameters

Name Type Required Default Values Note
band integer no 1 Not stated Not stated
field string no Not stated Not stated Name of the attribute that holds each polygon's cell value.
eight_connected boolean no no Not stated Join cells that touch only at a corner (8-connectedness) instead of only along edges.

Inputs and outputs

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

In each engine

Engine Tool Parameters Differences
gdal gdal raster polygonize
  • band → band
  • field → attribute-name
  • eight_connected → connect-diagonal-pixels
  • raster → input
  • output → output
None noted
grass r.to.vect
  • field → column
  • raster → input
  • output → output
None noted
Preset: {"type":"area"}
postgis-raster st_dumpaspolygons
  • band → band
  • raster → rast
  • Returns a set of (geom, val) rows.
qgis gdal:polygonize
  • band → BAND
  • field → FIELD
  • eight_connected → EIGHT_CONNECTEDNESS
  • raster → INPUT
  • output → OUTPUT
None noted
rasterio rasterio.features.shapes
  • eight_connected → connectivity : false = 4; true = 8
  • raster → source
  • A generator of (GeoJSON geometry, value) pairs from an array; pass the raster's transform to get map coordinates.
terra terra::as.polygons
  • eight_connected always no
  • raster → x
  • With aggregate = TRUE (the default) all cells with the same value become one polygon, connected or not.
whiteboxtools RasterToVectorPolygons
  • raster → input
  • output → output
None noted