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_hierarchy()
,
par_make_grid()
,
par_merge_grid()
,
par_multirasters()
,
par_pad_grid()
,
par_split_list()
Examples
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.24941, -75.79698, 33.88802, 36.55712 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat NAD27 (EPSG:4267)
#> names : AREA PERIMETER CNTY_ CNTY_ID NAME FIPS FIPSNO
#> type : <num> <num> <num> <num> <chr> <chr> <num>
#> values : 0.078 1.202 2056 2056 Graham 37075 3.708e+04
#> 0.125 2.868 2156 2156 Carteret 37031 3.703e+04
#> 0.153 2.206 1832 1832 Northampton 37131 3.713e+04
#> CRESS_ID BIR74 SID74 (and 5 more)
#> <int> <num> <num>
#> 38 415 0
#> 16 2414 5
#> 66 1421 9
#>
#> $padded
#> class : SpatVector
#> geometry : polygons
#> dimensions : 10, 1 (geometries, attributes)
#> extent : -1084.249, 924.203, -966.112, 1036.557 (xmin, xmax, ymin, ymax)
#> coord. ref. :
#> names : CGRIDID
#> type : <num>
#> values : 1
#> 2
#> 3
#>