Euclidian distances

euclidean_distances(
  x,
  id,
  centroid = TRUE,
  distance_unit = "m",
  keep = NULL,
  threshold = NULL,
  edgeParallel = FALSE,
  pairwise = TRUE,
  write_table = NULL
)

Arguments

x

object of class sf, sfc, sfg or SpatialPolygons. It must be in a projected coordinate system.

id

character. Column name with the patches+ id.

centroid

logical. If centroid is TRUE then the Euclidean distance is calculated from patch centroids, if FALSE the Euclidean distance is calculated from patch edges.

distance_unit

character. Set a distance unit, "Makurhini::unit_covert()" compatible unit ("m", "km", "inch", "foot", "yard", "mile"). Default equal to meters "m".

keep

numeric. Argument for higher processing speed. Only is available for "edge" distance or centroid equal FALSE, use this option to simplify the geometry and reduce the number of vertices. The value can range from 0 to 1 and is the proportion of points to retain (default 0.02). The higher the value, the higher the speed but the greater uncertainty.

threshold

numeric. Distance threshold, pairs of nodes with a distance value above this threshold will be discarded.

edgeParallel

logical. Only is available for "edge" distance or centroid equal FALSE, use this option to parallelize the edge distance using furrr package and multiprocess plan, default = FALSE.

pairwise

logical. If TRUE a pairwise table is returned (From, To, distance) otherwise it will be a matrix.

write_table

character. "" indicates output to the console.

Value

Pairwise Euclidean distance table

References

Douglas, David H. and Peucker, Thomas K. (1973) "Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or its Caricature", The Canadian Cartographer, 10(2), pp112-122.