eobox.vector.conversion

eobox.vector.conversion.calc_distance_to_border(polygons, template_raster, dst_raster, overwrite=False, keep_interim_files=False, verbosity=0)[source]

Calculate the distance of each raster cell (in and outside the polygons) to the next polygon border.

Parameters
  • {str} -- Filename to a geopandas-readable file with polygon features. (polygons) –

  • {[type]} -- Filename to a rasterio-readable file. (template_raster) –

  • {[type]} -- Destination filename for the distance to polygon border raster file (dst_raster) –

Keyword Arguments
  • {bool} -- Overwrite files if they exists? (default (overwrite) – {False})

  • {bool} -- Keep the interim line vector and raster files (default (keep_interim_files) – {True})

Returns

[type] – [description]

eobox.vector.conversion.convert_polygons_to_lines(src_polygons, dst_lines, crs=None, add_allone_col=False)[source]

Convert polygons to lines.

Parameters
  • {path to geopandas-readable file} -- Filename of the the polygon vector dataset to be (src_polygons) – converted to lines.

  • {[type]} -- Filename where to write the line vector dataset to. (dst_lines) –

Keyword Arguments
  • {dict or str} -- Output projection parameters as string or in dictionary format. (crs) – This will reproject the data when a crs is given (not {None}) (default: {None}).

  • {bool} -- Add an additional attribute column with all ones. (add_allone_col) – This is useful, e.g. in case you want to use the lines with gdal_proximity afterwards (default: {True}).

Returns

int – Exit code 0 if successeful.