Rasterize
Burns vector features into a raster grid, with a fixed value or a value from an attribute.
Pitfall. By default only cells whose centre falls inside a polygon are burned, so thin or small features can disappear.
Pitfall. Cells outside every feature are nodata in some engines and 0 in others.
| Also called | Feature To Raster, Polygon To Raster, Vector To Raster, burn |
|---|---|
| Group | conversion/vector-to-raster |
| Checks | crs.present, raster.nodata |
| 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 |
|---|---|---|---|---|---|
resolution | number | yes | Not stated | Not stated | Cell size, in the layer's CRS units. |
value | number | no | 1 | Not stated | Value burned into cells covered by a feature. |
field | field | no | Not stated | Not stated | Burn this attribute's value instead of a fixed value. |
all_touched | boolean | no | no | Not stated | Burn every cell a feature touches, not only cells whose centre it covers. |
Inputs and outputs
| Direction | Name | Type | Geometry | Note |
|---|---|---|---|---|
| Input | layer | vector | Not stated | Not stated |
| Output | output | raster | Not stated | Not stated |
In each engine
| Engine | Tool | Parameters | Differences |
|---|---|---|---|
gdal | gdal vector rasterize |
|
|
geocube | geocube.api.core.make_geocube |
|
|
grass | v.to.rast |
| None noted
Preset: {"use":"val"} |
postgis-raster | st_asraster |
|
|
qgis | gdal:rasterize |
| None noted |
rasterio | rasterio.features.rasterize |
|
|
terra | terra::rasterize |
|
|
whiteboxtools | VectorPolygonsToRaster |
|
|