revrt.utilities.raster.rasterize_shape_file#
- rasterize_shape_file(fname, width, height, transform, buffer_dist=None, all_touched=False, dest_crs=None, burn_value=1, boundary_only=False, dtype='float32')[source]#
Rasterize a vector layer
- Parameters:
fname (
str
) – Full path to GPKG or shp file.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
.reproject_vector (
bool
, defaultTrue
) – Reproject CRS of vector to match template raster ifTrue
. By default,True
.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:
array-like – Rasterized vector data