Randomly combine given polygons into contiguous, larger polygons.
Usage
make_parent_polygons(polygons, ids = NULL, n = 2, strict_n = TRUE,
n_as_min = FALSE, buffer_dist = 5e-05, min_overlap = NULL,
verbose = TRUE)
Arguments
- polygons
An
sf
object with polygons to be reformed.- ids
A vector of IDs the same length as
polygons
, or the column name inpolygons
to use as IDs.- n
Number of polygons to aim to combine for each new polygon.
- strict_n
Logical; if
TRUE
(default),n
represents the number of intersecting polygons to select, depending on availability (with a minimum of 2). IfFALSE
,n
represents the number of nearest polygons (by centroid) to use when calculating a box to use when selecting polygons (with a minimum of 1).- n_as_min
Logical; if
TRUE
, will merge any parents with fewer thann
children with a random neighbor. Otherwise (and by default), parents may have fewer thann
children. Applies ifstrict_n
isTRUE
.- buffer_dist
Distance around each initial shape or set of shapes, used to define neighboring shapes. Applies if
strict_n
isTRUE
- min_overlap
Minimal area of overlap between potential neighboring shapes and the buffered target shape, used to define neighboring shapes. Applies if
strict_n
isTRUE
- verbose
Logical; if
FALSE
, will not print status messages.