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: dtype[Any] | None | Type[Any] | _SupportsDType[dtype[Any]] | str | Tuple[Any, int] | Tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | List[Any] | _DTypeDict | Tuple[Any, Any] = 'float32') ndarray[Any, dtype[ScalarType]] [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