dis_rast | R Documentation |
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.
dis_rast(gaz, ras, buffer = NULL)
gaz |
an object of the class |
ras |
an object of the class |
buffer |
numerical. The size of the geographic buffer around the
extent of |
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
Check https://github.com/azizka/sampbias/wiki for a tutorial on sampbias.
calculate_bias
#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)
## Not run: plot(out[[1]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.