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

A GEOS geometry vector

keep_empty

If TRUE, EMPTY geomtries are left as-is rather than collapsing to length 0.

keep_multi

If TRUE, MULTI* geometries are not expanded to sub-features (i.e., only GEOMETRYCOLLECTIONs are).

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))")


[Package geos version 0.2.4 Index]