Flatten nested geometry structures
wkt_unnest(wkt, keep_empty = FALSE, keep_multi = TRUE, max_depth = 1)
wkb_unnest(wkb, keep_empty = FALSE, keep_multi = TRUE, max_depth = 1)
A character vector containing well-known text.
If TRUE
, a GEOMETRYCOLLECTION EMPTY is left as-is
rather than collapsing to length 0.
If TRUE
, MULTI* geometries are not expanded to sub-features.
The maximum recursive GEOMETRYCOLLECTION depth to unnest.
A list()
of raw()
vectors, such as that
returned by sf::st_as_binary()
.
An unclassed vector with attribute lengths
, which is an integer vector
with the same length as the input denoting the length to which each
feature was expanded.
wkt_unnest("GEOMETRYCOLLECTION (POINT (1 2), POINT (3 4))")
#> [1] "POINT (1 2)" "POINT (3 4)"
#> attr(,"lengths")
#> [1] 2
wkt_unnest("GEOMETRYCOLLECTION EMPTY")
#> character(0)
#> attr(,"lengths")
#> [1] 0
wkt_unnest("GEOMETRYCOLLECTION EMPTY", keep_empty = TRUE)
#> [1] "GEOMETRYCOLLECTION EMPTY"
#> attr(,"lengths")
#> [1] 1