dis_rast: Distance Rasters from a List of Geographic Gazetteers

View source: R/dis_rast.R

dis_rastR 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 list, including one or more geographic gazetteers of the class SpatVector.

ras

an object of the class SpatRaster. Defining the extent and resolution of the distances rasters.

buffer

numerical. The size of the geographic buffer around the extent of ras for the distance calculations in degrees, to account for geographic structures neighbouring the study area (such as a road right outside the study area) Default is to the resolution of ras.

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

calculate_bias

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)

## Not run: plot(out[[1]])


azizka/sampbias documentation built on Feb. 1, 2024, 7:51 p.m.