Count the number of points in a geometry

st_numpoints(.geom)

st_npoints(.geom)

Arguments

.geom

A geometry object.

See also

Examples

library(tibble) library(dplyr) tibble(x = 1:2, y = 3:4) %>% mutate(geom = st_makepoint(x, y), n = st_npoints(geom)) %>% summarise(line = st_makeline(geom), n = st_numpoints(line))
#> # A tibble: 1 x 2 #> line n #> <LINESTRING> <int> #> 1 (1 3, 2 4) 2