Distance Field#

rforge.library.processes.distance.distance(layer: Layer | ndarray, alpha: Layer | ndarray | None = None, thresholds: list | tuple | None = None, invert: bool = False, mask_size: int = 3, as_array: bool = False) ndarray | Layer[source]#

Calculate the distance field of a geographical region.

Parameters:
  • layer – Binary layer data.

  • alpha – Alpha layer. Defaults to None.

  • thresholds – Thresholds to use for image binarization. Defaults to None.

  • invert – If True, inverts the binary layer data before processing. Defaults to False.

  • mask_size – Size of the mask for distance calculation. Defaults to 3.

  • as_array – If True, returns the distance field as a Numpy array. Defaults to False.

Returns:

Distance field layer.

Raises:

TypeError – If inputs are not of the accepted type.