This will download all KNN layers in (Boreal) Forest of Canada, and make
a factor raster at resolution provided by res
(larger is faster).
speciesInStudyArea
defaults to use a url of a dataset uploaded to Google Drive that is
from Canadian Boreal Forests, but a different factor raster can be passed e.g.,
from speciesPresentFromKNN
.
Default (and only implemented) is 2011. This will download the 2011 KNN data layers
Passed to destinationPath
in preProcess
.
The resolution (one dimension, in m) for the resulting raster
An integer indicating what percent cover a species must have in a pixel to be considered present in that pixel.
A SpatialPolygons*
object used as the principle study region,
passed to reproducible::prepInputs()
.
A url to get a speciesPresence
raster e.g., from peciesPresentFromKNN
A factor raster where the character string is a string of
species names, separated by 2 underscores, sorted alphabetically. Can be produced
with speciesPresentFromKNN
A SpatRaster
object with 2 layers: "speciesPresent"
is a factor, with
a legend (i.e., it is numbers on a map, that correspond to a legend) and
"numberSpecies"
which represents the number of species in each pixel.
A named list of length 2: speciesRas
is a factor RasterLayer
and speciesList
is a character string containing the unique, sorted
species on the speciesRas
, for convenience.
if (FALSE) {
if (requireNamespace("googledrive", quietly = TRUE)) {
# Make the dataset
speciesPresent <- speciesPresentFromKNN(dPath = "~/data/KNN")
# To upload this:
speciesPresentRas <- terra::rast(speciesPresent)[[1]]
fn <- "SpeciesPresentInCanadianForests.tif"
writeRaster(speciesPresentRas, file = fn)
zipFn <- gsub(".tif", ".zip", fn)
zip(files = dir(pattern = fn), zipFn)
out <- googledrive::drive_put(zipFn)
driveID <- "1Oj78jJBeha5L6XDBBdWDAfimgNjYc9UD"
# Get species list
sa <- LandR::randomStudyArea(size = 1e11)
species <- LandR::speciesInStudyArea(sa)
}
}