Skip to contents

Iteratively merge spatial units to ensure all of them meet a minimum area threshold.

Usage

st_merge_spatialunits(
  x,
  merge_threshold,
  merge_type = "min_centroid_distance",
  contiguity = "rook",
  verbose = T
)

Arguments

x

a sf object with POLYGON geometries representing the spatial units to be merged.

merge_threshold

numeric; value in square meters represents the smallest acceptable area for a spatial unit. Contiguous units will be iteratively merged until this value is reached. To skip this process, set merge_threshold = NULL.

merge_type

string; criteria with which polygons are merged. Must be one of "min_centroid_distance", "min_adjacent_area", "max_adjacent_area", "min_shared_boundary", or "max_shared_boundary". Default = "min_centroid_distance".

contiguity

string; one of "queen" or "rook". Default = "rook".

verbose

logical; if FALSE no status messages will be output.

Value

A sf object with POLYGON geometries representing street block spatial units.

Examples

street_blocks <- st_create_streetblocks(x = bangalore_highways,
boundary = bangalore_boundary, merge_threshold = NULL, verbose = FALSE)
#> Warning: Small geometries (< 1 m^2) may be present. Use st_merge_spatialunits() to aggregate them.
street_blocks_merged <- st_merge_spatialunits(x = street_blocks,
merge_threshold = 4050, verbose = FALSE)
#> Warning: The `sf` geometry column was renamed before merging.
plot(street_blocks_merged)