View source: R/loadSpatialInputs.R
loadSpatialInputs | R Documentation |
Load spatial input data from file and then align the inputs to the
projectPoly
and refRast
. Inputs can be file names or spatial objects.
loadSpatialInputs(
projectPoly,
refRast,
inputsList,
convertToRast = NULL,
convertToRastDens = NULL,
altTemplate = NULL,
useTemplate = NULL,
reclassOptions = NULL,
bufferWidth = NULL,
ptDensity = 1,
rastOut = "terra"
)
projectPoly |
character or sf. A polygon delineating the study area. |
refRast |
character or raster. A raster which will be used as the
template that all other rasters must align to (but see |
inputsList |
list. A named list of inputs that are either spatial
objects or file names of spatial objects. ".shp" is the only extension
accepted for vector data and all other extensions will be passed to
|
convertToRast |
character. Optional. Names of elements of |
convertToRastDens |
character. Optional. Names of elements of
|
altTemplate |
raster. Optional template raster for raster inputs that
can have a different resolution from the |
useTemplate |
character. Optional. Names of elements of |
reclassOptions |
list. An optional named list containing a function, a
list where the first element is a function that takes the corresponding
|
bufferWidth |
numeric. The width of a moving window that will be applied
to the data. If it is supplied a buffer of 3* |
ptDensity |
number. Only used if an element of |
rastOut |
character. The format that rasters should be output with. "raster" for RasterLayers and "terra" for SpatRasters. The default is "terra". |
A named list with aligned spatial data components
Caribou habitat functions:
CaribouHabitat-class
,
calcBinaryUse()
,
caribouHabitat()
,
coefTableHR
,
coefTableStd
,
fnlcToResType
,
plcToResType
,
rasterizeLineDensity()
,
reclassPLC()
,
resTypeCode
,
results()
,
rfuToResType
,
threshTable
,
updateCaribou()
# create example rasters
lc <- terra::rast(xmin = 0, xmax = 25000, ymin = 0, ymax = 25000,
resolution = 250, crs = "EPSG:5070")
lc[] <- 0
nd <- lc
nd[1:30, 1:30] <- 1
ad <- lc
ad[30:50, 3:50] <- 1
lc[] <- 1
lc[70:100, 70:100] <- 2
# create sf objects
lf <- sf::st_as_sf(sf::st_sfc(list(sf::st_linestring(matrix(c(0, 0, 10000, 10000),
ncol = 2, byrow = TRUE))),
crs = 5070))
esk <- sf::st_as_sf(sf::st_sfc(list(sf::st_linestring(matrix(c(0, 10000, 10000, 0),
ncol = 2, byrow = TRUE))),
crs = 5070))
projPol <- sf::st_sf(sf::st_as_sfc(sf::st_bbox(ad)))
# prepare data
res <- loadSpatialInputs(projectPoly = projPol, refRast = lc,
inputsList = list(esker = esk, linFeat = lf, natDist = nd,
anthroDist = ad),
convertToRast = c("esker", "linFeat"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.