ds.rst.proximity() or Raster.proximity()

ds.rst.proximity() or Raster.proximity()#

RasterBase.proximity(vector=None, target_values=None, distance_unit='georeferenced', max_distance=None, mp_config=None)[source]#

Compute proximity distances to the raster target pixels, or to a vector geometry on the raster grid.

Match-reference: a raster can be passed to match its resolution, bounds and CRS for computing proximity distances.

When passing a vector, its current geometry is used. Apply a vector geometry operation first to calculate proximity to a derived geometry, for example vector.boundary.proximity(raster).

Parameters:
  • vector (VectorType | None) – Vector for which to compute the proximity to geometry, if not provided computed on this raster target pixels.

  • target_values (list[float] | None) – (Only with raster) List of target values to use for the proximity, defaults to all non-zero values.

  • distance_unit (Literal['pixel'] | Literal['georeferenced']) – Distance unit, either ‘georeferenced’ or ‘pixel’.

  • max_distance (float | None) – Largest distance to return, with farther cells set to nodata. This value is required for Dask and multiprocessing execution because it defines the overlap between chunks.

  • mp_config (MultiprocConfig | None) – Multiprocessing parameters. Cannot be combined with Dask input.

Return type:

RasterBase

Returns:

Proximity distances raster.