Extract meta information

wkb_meta(wkb, recursive = FALSE)

wkt_meta(wkt, recursive = FALSE)

wkt_streamer_meta(wkt, recursive = FALSE)

wk_geometry_type(type_id)

wk_geometry_type_id(type)

Arguments

wkb

A list() of raw() vectors, such as that returned by sf::st_as_binary().

recursive

Pass TRUE to recurse into multi-geometries and collections to extract meta of sub-geometries

wkt

A character vector containing well-known text.

type_id

An integer version of the geometry type

type

A string version of the geometry type (e.g., point, linestring, polygon, multipoint, multilinestring, multipolygon, geometrycollection)

Value

A data.frame with columns:

  • feature_id: The index of the top-level feature

  • nest_id: The recursion level (if feature is a geometry collection)

  • part_id: The part index (if nested within a multi-geometry or collection)

  • type_id: The type identifier (see wk_geometry_type())

  • size: For points and linestrings the number of points, for polygons the number of rings, and for mutlti-geometries and collection types, the number of child geometries.

  • srid: The spatial reference identifier as an integer

Examples

wkt_meta("POINT (30 10)")
#> # A tibble: 1 × 7
#>   feature_id part_id type_id  size  srid has_z has_m
#>        <int>   <int>   <int> <int> <int> <lgl> <lgl>
#> 1          1       1       1     1    NA FALSE FALSE
wkt_meta("GEOMETRYCOLLECTION (POINT (30 10))", recursive = FALSE)
#> # A tibble: 1 × 7
#>   feature_id part_id type_id  size  srid has_z has_m
#>        <int>   <int>   <int> <int> <int> <lgl> <lgl>
#> 1          1       1       7     1    NA FALSE FALSE
wkt_meta("GEOMETRYCOLLECTION (POINT (30 10))", recursive = TRUE)
#> # A tibble: 2 × 7
#>   feature_id part_id type_id  size  srid has_z has_m
#>        <int>   <int>   <int> <int> <int> <lgl> <lgl>
#> 1          1       1       7     1    NA FALSE FALSE
#> 2          1       2       1     1    NA FALSE FALSE