dis_rast {sampbias} | R Documentation |
Distance Rasters from a List of Geographic Gazetteers
Description
Creates a list of distances rasters based on a list of geographic gazetteers, as SpatVector objects, and a template SpatRaster, indicating the desired extent and resolution.
Usage
dis_rast(gaz, ras, buffer = NULL)
Arguments
gaz |
an object of the class |
ras |
an object of the class |
buffer |
numerical. The size of the geographic buffer around the
extent of |
Value
a list
of SpatRaster
objects of the same length as
gaz
. The values in each raster correspond to the planar geographic
distance to the next feature in gaz
, given the resolution of
ras
Note
Check https://github.com/azizka/sampbias/wiki for a tutorial on sampbias.
See Also
Examples
#create raster for resolution and extent
ras <- terra::rast(terra::ext(-5,5,-4,4), res = 1)
#create point gazeteer
pts <- data.frame(long = runif(n = 5, min = -5, max = 5),
lat = runif(n = 5, min = -4, max = 4),
dat = rep("A", 5))
pts <- terra::vect(pts, geom = c("long", "lat"))
lin <- as.matrix(data.frame(long = seq(-5, 5, by = 1),
lat = rep(2, times = 11)))
lin <- terra::vect(lin, type = "line")
gaz <- list(point.structure = pts, lines.strucutre = lin)
out <- dis_rast(gaz, ras)