geos_unnest {geos} | R Documentation |
Unnest nested geometries
Description
Ths function flattens nested geometries (i.e., multi or
geometrycollection types) into a vector with the same or fewer levels of
nesting. See geos_geometry_n()
to access individual geometries within a
collection; see wk::wk_flatten()
for a version of this function that
works with non-GEOS geometries; see geos_make_collection()
and
wk::wk_collection()
for functions that perform the inverse operation.
Usage
geos_unnest(geom, keep_empty = FALSE, keep_multi = TRUE, max_depth = 1)
Arguments
geom |
|
keep_empty |
If |
keep_multi |
If |
max_depth |
The maximum recursive GEOMETRYCOLLECTION depth to unnest. |
Value
A GEOS geometry vector, with a length
greater than or equal to geom
with an attribute "lengths"
that can be used to map elements of the result to the
original item.
Examples
geos_unnest("GEOMETRYCOLLECTION (POINT (1 2), POINT (3 4))")