remotior_sensus.tools.raster_to_vector module

Raster to vector.

This tool allows for the conversion from raster to vector. A new geopackage is created from the raster conversion.

Typical usage example:

>>> # import Remotior Sensus and start the session
>>> import remotior_sensus
>>> rs = remotior_sensus.Session()
>>> # start the process
>>> vector = rs.raster_to_vector(raster_path='file.tif',output_path='vector.gpkg')
remotior_sensus.tools.raster_to_vector.raster_to_vector(raster_path, output_path: None | str = None, dissolve: bool | None = None, field_name: None | str = None, extent_list: list | None = None, n_processes: None | int = None, available_ram: None | int = None) OutputManager

Performs the conversion from raster to vector.

This tool performs the conversion from raster to vector. Parallel processes are used for the conversion, resulting in a vector output which is split as many in portions as the process numbers. The argument dissolve allows for merging these portions, but it requires additional processing time depending on vector size.

Parameters:
  • raster_path – path of raster used as input.

  • output_path – string of output path.

  • dissolve – if True, dissolve adjacent polygons having the same values; if False, polygons are not dissolved and the process is rapider.

  • field_name – name of the output vector field to store raster values (default = DN).

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

  • n_processes – number of parallel processes.

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

Returns:

object OutputManager() with
  • path = output path

Examples

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