Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

wk_count

Count geometry components


Description

Counts the number of geometries, rings, and coordinates found within each feature. As opposed to wk_meta(), this handler will iterate over the entire geometry.

Usage

wk_count(handleable, ...)

## Default S3 method:
wk_count(handleable, ...)

wk_count_handler()

Arguments

handleable

A geometry vector (e.g., wkb(), wkt(), xy(), rct(), or sf::st_sfc()) for which wk_handle() is defined.

...

Passed to the wk_handle() method.

Value

A data.frame with one row for every feature encountered and columns:

  • n_geom: The number of geometries encountered, including the root geometry. Will be zero for a null feature.

  • n_ring: The number of rings encountered. Will be zero for a null feature.

  • n_coord: The number of coordinates encountered. Will be zero for a null feature.

Examples

wk_count(as_wkt("LINESTRING (0 0, 1 1)"))
wk_count(as_wkb("LINESTRING (0 0, 1 1)"))

wk

Lightweight Well-Known Geometry Parsing

v0.4.1
MIT + file LICENSE
Authors
Dewey Dunnington [aut, cre] (<https://orcid.org/0000-0002-9415-4582>), Edzer Pebesma [aut] (<https://orcid.org/0000-0001-8049-7069>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.