onstove.VectorLayer.proximity#
- VectorLayer.proximity(base_layer: str | RasterLayer | None, output_path: str | None = None, create_raster: bool | None = True) RasterLayer[source]#
Calculates a euclidean proximity distance raster based on the given vector layer.
It uses the
scipy.ndimage.distance_transform_edtfunction to calculate an exact Euclidean distance transform.- Parameters:
- base_layer: str or RasterLayer
Raster layer used as a template to calculate the proximity of the vectors to each grid cell in the base layer. The
base_layermust be either a str of the path to a raster file or aRasterLayerobject. The metadata of the base layer will become the metadata of the proximity raster.- output_path: str, optional
A folder path where to save the output dataset. If not defined then the proximity dataset is not saved.
- create_raster: bool, default True
Boolean condition. If True, a
RasterLayerwill be created and stored in thedistance_rasterattribute of the class. If False, aRasterLayerwith the proximity distance calculation is returned.
- Returns:
- RasterLayer
RasterLayercontaining the distance to the nearest point of the currentVectorLayer.
See also