Rasterization
- remote_sensing_processor.rasterize(vector, reference_raster, value, output_path, nodata=0, write_stac=True)[source]
Rasterizes a vector file.
- Parameters:
vector (path to vector as a string) – Path to a vector file that needs to be rasterized.
reference_raster (string or STAC Item) – Path to a raster file to get shape, resolution and projection from.
value (string) – A field to use for a burn-in value. Field should be numeric.
output_path (string) – Path to an output file.
nodata (int or float (default = 0)) – A value that will be used as nodata.
write_stac (bool (default = True)) – If True, then output metadata is saved to a STAC file.
- Returns:
Path where output raster is saved.
- Return type:
pathlib.Path
Examples
>>> import remote_sensing_processor as rsp >>> rsp.rasterize( ... vector="/home/rsp_test/mosaics/treecover/treecover.shp", ... reference_raster="/home/rsp_test/mosaics/sentinel/B1.tif", ... value="tree_species", ... output_path="/home/rsp_test/mosaics/treecover/treecover.tif", ... nodata=0, ... )