This function creates a new sdm_area
object.
Usage
sdm_area(x, cell_size = NULL, crs = NULL, variables_selected = NULL,
gdal = TRUE, crop_by = NULL, lines_as_sdm_area = FALSE)
get_sdm_area(i)
Arguments
- x
A shape or a raster. Usually a shape from
sf
class, but rasters fromstars
,rasterStack
orSpatRaster
class are also allowed.- cell_size
numeric
. The cell size to be used in models.- crs
numeric
. Indicates which EPSG should the output grid be in. IfNULL
, epsg fromx
is used.- variables_selected
A
character
vector with variables inx
to be used in models. IfNULL
(standard), all variables inx
are used.- gdal
Boolean. Force the use or not of GDAL when available. See details.
- crop_by
A shape from
sf
to cropx
.- lines_as_sdm_area
Boolean. If
x
is asf
with LINESTRING geometry, it can be used to model species distribution in lines and not grid cells.- i
A
sdm_area
or ainput_sdm
object.
Value
A sdm_area
object containing:
- grid
sf
withPOLYGON
geometry representing the grid for the study area.- cell_size
numeric
information regarding the size of the cell used to rescale variables to the study area, representing also the cell size in thegrid
.
Details
The function returns a sdm_area
object with a grid built upon the x
parameter.
There are two ways to make the grid and resample the variables in sdm_area
: with and
without gdal. As standard, if gdal is available in you machine it will be used (gdal = TRUE
),
otherwise sf/stars will be used.
get_sdm_area
will return the grid built by sdm_area
.
Examples
# Create sdm_area object:
sa_area <- sdm_area(parana, cell_size = 50000, crs = 6933)
#> ! Making grid over study area is an expensive task. Please, be patient!
#> ℹ Using GDAL to make the grid and resample the variables.
# Create sdm_area using a subset of rivs (lines):
sa_rivers <- sdm_area(rivs[c(1:100),], cell_size = 100000, crs = 6933, lines_as_sdm_area = TRUE)
#> ! Making grid over study area is an expensive task. Please, be patient!
#> ℹ Using GDAL to make the grid and resample the variables.