Combine several feature geometries into one, without unioning or resolving internal boundaries
st_combine(x) st_union(x, y, ..., by_feature = FALSE)
object of class
object of class
logical; if TRUE, union each feature, if FALSE return a single feature that is the geometric union of the set of features
st_combine returns a single, combined geometry, with no resolved boundaries; returned geometries may well be invalid.
y is missing,
st_union(x) returns a single geometry with resolved boundaries, else the geometries for all unioned pairs of x[i] and y[j].
st_union is called with a single argument,
y missing) and
FALSE all geometries are unioned together and an
sfg or single-geometry
sfc object is returned. If
TRUE each feature geometry is unioned. This can for instance be used to resolve internal boundaries after polygons were combined using
y is provided, all elements of
y are unioned, pairwise (and
by_feature is ignored). The former corresponds to gUnaryUnion, the latter to gUnion.
Unioning a set of overlapping polygons has the effect of merging the areas (i.e. the same effect as iteratively unioning all individual polygons together). Unioning a set of LineStrings has the effect of fully noding and dissolving the input linework. In this context "fully noded" means that there will be a node or endpoint in the output for every endpoint or line segment crossing in the input. "Dissolved" means that any duplicate (e.g. coincident) line segments or portions of line segments will be reduced to a single line segment in the output. Unioning a set of Points has the effect of merging all identical points (producing a set with no duplicates).
#> Reading layer `nc' from data source `/tmp/RtmpLZ7vdN/temp_libpath7f692827f870/sf/shape/nc.shp' using driver `ESRI Shapefile' #> Simple feature collection with 100 features and 14 fields #> geometry type: MULTIPOLYGON #> dimension: XY #> bbox: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965 #> epsg (SRID): 4267 #> proj4string: +proj=longlat +datum=NAD27 +no_defsst_combine(nc)#> Geometry set for 1 feature #> geometry type: MULTIPOLYGON #> dimension: XY #> bbox: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965 #> epsg (SRID): 4267 #> proj4string: +proj=longlat +datum=NAD27 +no_defs#>plot(st_union(nc))