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.7071068,   0.7071068,   0.7071068,   0.7071068,   0.7071068 
#> max values  : 315.5954689, 315.5954689, 315.5954689, 315.5954689, 157.4817450 

# 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.7071068,  50.50248 
#> max values  : 254.3629297, 211.42493