View source: R/extract_vertices.R
extract.vertices | R Documentation |
Extracts [x,y] vertices from an sf line or polygon object
extract.vertices(x, join = TRUE)
x |
An sf line or polygon class object |
join |
(TRUE/FALSE) Joint attributes from original object |
This function returns the vertices of a line or polygon object, as opposed to the polygon centroids or line start/stop coordinates
An sf POINT object of extrated line or polygon vertices
Jeffrey S. Evans <jeffrey_evans@tnc.org>
library(sf)
nc <- sf::st_read(system.file("shape/nc.shp", package="sf"))
nc <- suppressWarnings(sf::st_cast(nc, "POLYGON"))
nc <- nc[c(10,50),]
( v <- extract.vertices(nc) )
plot(st_geometry(nc))
plot(st_geometry(v), pch=20, cex=2, col="red", add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.