View source: R/sample_systematic.R
sample_systematic | R Documentation |
Systematic sampling with random start point and translation within a square or hexagonal tessellation.
sample_systematic(
raster,
cellsize,
square = TRUE,
location = "centers",
force = FALSE,
access = NULL,
buff_inner = NULL,
buff_outer = NULL,
plot = FALSE,
filename = NULL,
overwrite = FALSE,
details = FALSE,
...
)
raster |
spatRaster. Raster used to define extent of fishnet grid. |
cellsize |
Numeric. Desired cellsize for tessellation. |
square |
Logical. Tessellation shape. Default is regular square grid,
if |
location |
Character. Sample location within tessellation. |
force |
Logical. Only applies when |
access |
sf. Road access network - must be lines. |
buff_inner |
Numeric. Inner buffer boundary specifying distance from access where plots cannot be sampled. |
buff_outer |
Numeric. Outer buffer boundary specifying distance from access where plots can be sampled. |
plot |
Logical. Plots output strata raster with samples. |
filename |
Character. Path to write output samples. |
overwrite |
Logical. Choice to overwrite existing |
details |
Logical. If |
... |
Additional arguments for |
An sf object with sampled points over a tessellation.
Specifying location = "random"
can result in tessellations with no samples.
This results from raster
have NA
values at the random location chosen.
Using force = TRUE
removes areas of NA
from sampling entirely, but
considerably slows processing speeds. Thanks to R. Hijmans for help in debugging and
providing suggestions for this script.
Tristan R.H. Goodbody, Lukas Winiwarter
Other sample functions:
sample_ahels()
,
sample_balanced()
,
sample_clhs()
,
sample_existing()
,
sample_nc()
,
sample_srs()
,
sample_strat()
,
sample_sys_strat()
#--- Load raster and access files ---#
r <- system.file("extdata", "mraster.tif", package = "sgsR")
mr <- terra::rast(r)
#--- perform grid sampling ---#
sample_systematic(
raster = mr,
cellsize = 1000
)
sample_systematic(
raster = mr,
cellsize = 1000,
location = "corners",
plot = TRUE
)
sample_systematic(
raster = mr,
cellsize = 1000,
square = FALSE,
location = "random",
plot = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.