Generates voronoi polygons by first performing stratified sampling across boundary polygons, then by running the voronoisation with st_voronoi().
tesselate_voronoi(
boundaries,
with,
boundary = "sfa",
sample_surface = FALSE,
sample_points = TRUE,
nb_samples = NULL,
min_size = 1500,
stratify = TRUE,
seed = 1
)
[sf] The boundaries to be used.
[sf] A set of data points to use for voronoisation.
[character] The column in boundaries
that is to
be used for the stratified sampling.
[logical] Whether to sample the surfaces in
boundaries
, Default to FALSE
.
[logical] Whether to sample points from with
or
to take all points in with
. Default to TRUE
.
[named character vector] The number of samples to draw
by boundary polygons (must bear the levels of boundary
as names
or be a single value to be applied to each level).
[numeric] The minimum size for a polygon above which it will be merged (in km2).
[logical] Whether the discretization happens within the boundaries or whether the whole area is to be used (default to TRUE).
[numeric] Passed onto set.seed()
,
important for reproducibility of sampling.
A named list with three elements (each an sf
object):
* patches
, the voronoi polygons generated
* points
, the points used for the tessellation.
data(borealis_simulated, package = "sspm")
data(sfa_boundaries, package = "sspm")
tesselate_voronoi(sfa_boundaries, with = borealis, sample_surface = TRUE,
boundary = "sfa", nb_samples = 10)
#> $patches
#> Simple feature collection with 40 features and 3 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: -64.18658 ymin: 46.00004 xmax: -46.6269 ymax: 60.84469
#> Geodetic CRS: WGS 84
#> # A tibble: 40 × 4
#> sfa patch_id patch_area geometry
#> * <chr> <fct> [km^2] <POLYGON [°]>
#> 1 4 P1 4945. ((-63.30252 59.8266, -61.99686 60.78698, -61.99048…
#> 2 4 P2 4319. ((-60.3537 59.58289, -60.72773 58.94674, -60.59988…
#> 3 4 P3 8328. ((-62.41861 58.76298, -61.87269 60.47405, -61.9968…
#> 4 4 P4 3904. ((-61.99048 60.84469, -61.99686 60.78698, -61.8726…
#> 5 4 P5 8916. ((-60.91758 57.68787, -60.93575 57.69861, -60.9357…
#> 6 4 P6 5286. ((-62.22483 58.58756, -61.71019 59.02802, -61.5420…
#> 7 4 P7 3228. ((-61.39129 59.18604, -60.77284 59.86003, -61.5420…
#> 8 4 P8 3312. ((-60.54774 59.91234, -60.77284 59.86003, -61.3912…
#> 9 4 P9 5337. ((-60.18751 57.68945, -60.17467 57.68869, -60.1741…
#> 10 5 P10 11209. ((-59.07859 55.37257, -58.945 55.46567, -58.58355 …
#> # ℹ 30 more rows
#>
#> $points
#> Simple feature collection with 40 features and 2 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -62.90629 ymin: 46.20124 xmax: -47.38968 ymax: 60.62645
#> Geodetic CRS: WGS 84
#> First 10 features:
#> sfa area geometry
#> 1 4 47575648300 [m^2] POINT (-62.90629 60.62645)
#> 2 4 47575648300 [m^2] POINT (-61.42425 59.70269)
#> 3 4 47575648300 [m^2] POINT (-59.80715 58.04987)
#> 4 4 47575648300 [m^2] POINT (-59.6313 57.70734)
#> 5 4 47575648300 [m^2] POINT (-61.00018 58.84686)
#> 6 4 47575648300 [m^2] POINT (-61.15296 60.41194)
#> 7 4 47575648300 [m^2] POINT (-60.87372 59.19752)
#> 8 4 47575648300 [m^2] POINT (-61.78665 59.75678)
#> 9 4 47575648300 [m^2] POINT (-62.35403 59.93536)
#> 10 4 47575648300 [m^2] POINT (-60.4377 58.93765)
#>