reVX.least_cost_xmission.layers.utils.rasterize_shape_file
- rasterize_shape_file(fname: str, profile: Dict, buffer_dist: float | None = None, all_touched: bool = False, reproject_vector: bool = True, burn_value: int | float = 1, boundary_only: bool = False, dtype: type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None = 'float32') ndarray[tuple[Any, ...], dtype[_ScalarT]] [source]
Rasterize a vector layer.
- Parameters:
fname (str) – Full path to gpgk or shp file
profile (dict) – Raster profile to use
buffer_dist (float, optional) – Distance to buffer features in fname by. Same units as the template raster. By default,
None
.all_touched (bool, optional) – Set all cells touched by vector to 1. False results in less cells being set to 1. By default,
False
.reproject_vector (bool, optional) – Reproject CRS of vector to match template raster if True. By default,
True
.burn_value (int | float, optional) – Value used to burn vectors into raster. By default,
1
.boundary_only (bool, optional) – If True, rasterize boundary of vector. By default,
False
.dtype (np.dtype, optional) – Datatype to use. By default,
float32
.
- Returns:
numpy.nd_array – Rasterized vector data