This function utilizes anticlust::balanced_clustering()
to split the input into equal size subgroups then transform the data
to be compatible with the output of par_pad_grid
, for which
a set of padded grids of the extent of input point subsets
(as recorded in the field named "CGRIDID"
)
is generated out of input points.
Value
A list of two,
original
: exhaustive and non-overlapping grid polygons in the class of inputpadded
: a square buffer of each polygon inoriginal
. Used for computation.
See also
Other Parallelization:
par_cut_coords()
,
par_grid()
,
par_grid_mirai()
,
par_hierarchy()
,
par_hierarchy_mirai()
,
par_make_dggrid()
,
par_make_grid()
,
par_make_h3()
,
par_merge_grid()
,
par_multirasters()
,
par_multirasters_mirai()
,
par_pad_grid()
,
par_split_list()
Examples
lastpar <- par(mfrow = c(1, 1))
library(terra)
library(sf)
options(sf_use_s2 = FALSE)
ncpath <- system.file("gpkg/nc.gpkg", package = "sf")
nc <- terra::vect(ncpath)
nc_rp <- terra::spatSample(nc, 1000)
nc_gr <- par_pad_balanced(nc_rp, 10L, 1000)
nc_gr
#> $original
#> class : SpatVector
#> geometry : points
#> dimensions : 1000, 15 (geometries, attributes)
#> extent : -84.2674, -75.72959, 33.94107, 36.5605 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat NAD27 (EPSG:4267)
#> names : AREA PERIMETER CNTY_ CNTY_ID NAME FIPS FIPSNO CRESS_ID
#> type : <num> <num> <num> <num> <chr> <chr> <num> <int>
#> values : 0.154 1.68 2030 2030 Harnett 37085 3.708e+04 43
#> 0.201 1.805 1968 1968 Randolph 37151 3.715e+04 76
#> 0.08 1.188 2123 2123 Scotland 37165 3.716e+04 83
#> BIR74 SID74 (and 5 more)
#> <num> <num>
#> 3776 6
#> 4456 7
#> 2255 8
#>
#> $padded
#> class : SpatVector
#> geometry : polygons
#> dimensions : 10, 1 (geometries, attributes)
#> extent : -1084.267, 924.2704, -966.0589, 1036.56 (xmin, xmax, ymin, ymax)
#> coord. ref. :
#> names : CGRIDID
#> type : <num>
#> values : 1
#> 2
#> 3
#>
par(lastpar)