Returns a function that generates Euclidean Distance Fields from specified locations (default: four corners and center of the raster extent).

proxy_edf(coords = NULL)

Arguments

coords

Optional coordinates. Can be a matrix, data frame, sf, or SpatVector with x and y columns. If NULL, uses default locations: four corners and center of the raster extent.

Value

A function that accepts rast_grid and returns a SpatRaster

Examples

rast_grid = terra::rast(
  ncols = 300, nrows = 100,
  xmin = 0, xmax = 300,
  ymin = 0, ymax = 100
)

# Default: four corners and center
make_proxy(rast_grid, proxy_edf())
#> class       : SpatRaster
#> size        : 100, 300, 5  (nrow, ncol, nlyr)
#> resolution  : 1, 1  (x, y)
#> extent      : 0, 300, 0, 100  (xmin, xmax, ymin, ymax)
#> coord. ref. : 
#> source(s)   : memory
#> names       :       EDF1,       EDF2,       EDF3,       EDF4,       EDF5
#> min values  :   0.707107,   0.707107,   0.707107,   0.707107,   0.707107
#> max values  : 315.595469, 315.595469, 315.595469, 315.595469, 157.481745

# Custom coordinates
custom_coords = matrix(c(50, 50, 150, 150), ncol = 2, byrow = TRUE)
rownames(custom_coords) = c("point1", "point2")
make_proxy(rast_grid, proxy_edf(coords = custom_coords))
#> class       : SpatRaster
#> size        : 100, 300, 2  (nrow, ncol, nlyr)
#> resolution  : 1, 1  (x, y)
#> extent      : 0, 300, 0, 100  (xmin, xmax, ymin, ymax)
#> coord. ref. : 
#> source(s)   : memory
#> names       :    point1,     point2
#> min values  :  0.707107,  50.502475
#> max values  : 254.36293, 211.424928