Balanced raster sampling using lcube
and
lpm2_kdtree
methods
Usage
sample_balanced(
mraster,
nSamp,
algorithm = "lpm2_kdtree",
p = NULL,
access = NULL,
buff_inner = NULL,
buff_outer = NULL,
plot = FALSE,
filename = NULL,
overwrite = FALSE
)
Arguments
- mraster
spatRaster. ALS metrics raster.
- nSamp
Numeric. Number of desired samples.
- algorithm
Character. One of
lpm2_kdtree, lcube, lcubestratified
.- p
Numeric. Vector with length equal to the number of cells in
mraster
representing the inclusion probability for each candidate sample. Default =nSamp / N
, whereN
is the number of cells.- access
sf 'LINESTRING' or 'MULTILINESTRING'. Access network.
- 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 and visualized strata with boundary dividers.
- filename
Character. Path to write stratified raster to disc.
- overwrite
Logical. Specify whether
filename
should be overwritten on disc.
References
Anton Grafström and Jonathan Lisic (2019). BalancedSampling: Balanced and Spatially Balanced Sampling. R package version 1.5.5. https://CRAN.R-project.org/package=BalancedSampling
Jonathan Lisic and Anton Grafström (2018). SamplingBigData: Sampling Methods for Big Data. R package version 1.0.0. https://CRAN.R-project.org/package=SamplingBigData
Grafström, A. Lisic, J (2018). BalancedSampling: Balanced and Spatially Balanced Sampling. R package version 1.5.4. http://www.antongrafstrom.se/balancedsampling
See also
Other sample functions:
sample_ahels()
,
sample_clhs()
,
sample_existing()
,
sample_nc()
,
sample_srs()
,
sample_strat()
,
sample_sys_strat()
,
sample_systematic()
Examples
#--- Load raster and existing plots---#
r <- system.file("extdata", "mraster.tif", package = "sgsR")
mr <- terra::rast(r)
sample_balanced(
mraster = mr,
nSamp = 200
)
#> Simple feature collection with 200 features and 0 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 431110 ymin: 5337730 xmax: 438490 ymax: 5343230
#> Projected CRS: +proj=utm +zone=17 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
#> First 10 features:
#> geometry
#> 1 POINT (435450 5343230)
#> 2 POINT (433270 5343210)
#> 3 POINT (434930 5343210)
#> 4 POINT (435970 5343210)
#> 5 POINT (434790 5343170)
#> 6 POINT (434530 5343150)
#> 7 POINT (431110 5343110)
#> 8 POINT (431510 5343110)
#> 9 POINT (437850 5343110)
#> 10 POINT (435290 5343030)