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
sfobject with polygons to be reformed.- ids
A vector of IDs the same length as
polygons, or the column name inpolygonsto use as IDs.- n
Number of polygons to aim to combine for each new polygon.
- strict_n
Logical; if
TRUE(default),nrepresents the number of intersecting polygons to select, depending on availability (with a minimum of 2). IfFALSE,nrepresents 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 thannchildren with a random neighbor. Otherwise (and by default), parents may have fewer thannchildren. Applies ifstrict_nisTRUE.- buffer_dist
Distance around each initial shape or set of shapes, used to define neighboring shapes. Applies if
strict_nisTRUE- min_overlap
Minimal area of overlap between potential neighboring shapes and the buffered target shape, used to define neighboring shapes. Applies if
strict_nisTRUE- verbose
Logical; if
FALSE, will not print status messages.