⚠️ Our 0.1 release refactored several early-development functions for long-term stability, to update your code see here. ⚠️
Future changes will come with deprecation warnings! 🙂



Vector.proximity(raster=None, size=(1000, 1000), geometry_type='boundary', in_or_out='both', distance_unit='georeferenced')[source]#

Compute proximity distances to this vector’s geometry.

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

Alternatively, a grid size can be passed to create a georeferenced grid with the bounds and CRS of this vector.

By default, the boundary of the Vector’s geometry will be used. The full geometry can be used by passing “geometry”, or any lower dimensional geometry attribute such as “centroid”, “envelope” or “convex_hull”. See all geometry attributes in the Shapely documentation at https://shapely.readthedocs.io/.

  • raster (Raster | None) – Raster to burn the proximity grid on.

  • size (tuple[int, int]) – If no Raster is provided, grid size to use with this Vector’s extent and CRS (defaults to 1000 x 1000).

  • geometry_type (str) – Type of geometry to use for the proximity, defaults to ‘boundary’.

  • in_or_out (Union[Literal['in'], Literal['out'], Literal['both']]) – Compute proximity only ‘in’ or ‘out’-side the polygon, or ‘both’.

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

Return type:



Proximity raster.