remotior_sensus.tools.vector_to_raster module

Vector to raster.

This tool allows for the conversion from vector polygons to raster.

Typical usage example:

>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> # start the process
>>> vector = rs.vector_to_raster(vector_path='file.gpkg',
...     output_path='vector.tif')
remotior_sensus.tools.vector_to_raster.vector_to_raster(vector_path, align_raster: str | BandSet | int, vector_field: None | str = None, constant: None | int = None, pixel_size: None | int = None, output_path: None | str = None, method: None | str = None, area_precision: int | None = 20, resample='mode', nodata_value: None | int = None, minimum_extent: bool | None = True, extent_list: list | None = None, output_format='GTiff', compress=None, compress_format=None, n_processes: None | int = None, available_ram: None | int = None, bandset_catalog: BandSetCatalog | None = None) OutputManager

Performs the conversion from vector to raster.

This tool performs the conversion from vector polygons to raster.

Parameters:
  • vector_path – path of vector used as input.

  • align_raster – optional string path of raster used for aligning output pixels and projections; it can also be a BandSet or an integer number of a BandSet in a Catalog.

  • output_path – string of output path.

  • vector_field – the name of the field used as reference value.

  • constant – integer value used as reference for all the polygons.

  • pixel_size – size of pixel of output raster.

  • minimum_extent – if True, raster has the minimum vector extent; if False, the extent is the same as the align raster.

  • extent_list – list of boundary coordinates left top right bottom.

  • output_format – output format, default GTiff

  • method – method of conversion, default pixel_center, other methods are all_touched for burning all pixels touched or area_based for burning values based on area proportion.

  • area_precision – for area_based method, the higher the value, the more is the precision in area proportion calculation.

  • resample – type for resample when method is area_based.

  • compress – if True, compress the output raster.

  • compress_format – compress format.

  • nodata_value – value to be considered as nodata.

  • n_processes – number of parallel processes.

  • available_ram – number of megabytes of RAM available to processes.

  • bandset_catalog – BandSetCatalog object.

Returns:

object OutputManager() with
  • path = output path

Examples

Perform the conversion to raster of a vector
>>> vector_to_raster(vector_path='file.gpkg',output_path='vector.tif')