revrt.utilities.raster.rasterize#
- rasterize(gdf, width, height, transform, buffer_dist=None, all_touched=False, burn_value=1, boundary_only=False, dtype='float32')[source]#
Rasterize a vector layer
- Parameters:
gdf (
geopandas.DataFrame
) – Geopandas DataFrame contains shapes to rasterize.width (
int
) – Width of output raster.height (
int
) – Height of output raster.transform (
affine.Affine
) – Affine transform for output raster.buffer_dist (
float
, optional) – Distance to buffer features in fname by. Same units as the template raster. By default,None
.all_touched (
bool
, defaultFalse
) – Set all cells touched by vector to 1. False results in less cells being set to 1. By default,False
.burn_value (
int | float
, default1
) – Value used to burn vectors into raster. By default,1
.boundary_only (
bool
, defaultFalse
) – IfTrue
, rasterize boundary of vector. By default,False
.dtype (
np.dtype
, default"float32"
) – Datatype to use. By default,float32
.
- Returns:
numpy.nd_array
– Rasterized vector data