extract.vertices {spatialEco} | R Documentation |
Extract vertices for polygons or lines
Description
Extracts [x,y] vertices from an sf line or polygon object
Usage
extract.vertices(x, join = TRUE)
Arguments
x |
An sf line or polygon class object |
join |
(TRUE/FALSE) Joint attributes from original object |
Details
This function returns the vertices of a line or polygon object, as opposed to the polygon centroids or line start/stop coordinates
Value
An sf POINT object of extrated line or polygon vertices
Author(s)
Jeffrey S. Evans <jeffrey_evans@tnc.org>
Examples
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)
[Package spatialEco version 2.0-2 Index]