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

npts

count the number of points/vertices/nodes of sf objects


Description

count the number of points/vertices/nodes of sf objects

Usage

npts(x, by_feature = FALSE)

Arguments

x

an sf/sfc object

by_feature

count total number of vertices (FALSE) of for each feature (TRUE).

Note

currently only works for *POINTS, *LINES and *POLYGONS (not GEOMETRYCOLLECTION).

Examples

npts(franconia)
npts(franconia, by_feature = TRUE)
npts(sf::st_geometry(franconia[1, ])) # first polygon

npts(breweries) # is the same as
nrow(breweries)

mapview

Interactive Viewing of Spatial Data in R

v2.10.0
GPL (>= 3) | file LICENSE
Authors
Tim Appelhans [cre, aut], Florian Detsch [aut], Christoph Reudenbach [aut], Stefan Woellauer [aut], Spaska Forteva [ctb], Thomas Nauss [ctb], Edzer Pebesma [ctb], Kenton Russell [ctb], Michael Sumner [ctb], Jochen Darley [ctb], Pierre Roudier [ctb], Patrick Schratz [ctb], Environmental Informatics Marburg [ctb], Lorenzo Busetto [ctb]
Initial release

We don't support your browser anymore

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