Vertices of a SpatialPolygonsDataFrame

Share:

Description

Extract vertices from a SpatialPolygonsDataFrame and optionally applies an aggregating function to each Polygon.

Value

A SpatialPointsDataFrame containing an id column corresponding to each extracted Polygon.

Methods

"SpatialPolygonsDataFrame", FUN = function

Extract Polygon vertices and remove the last (repeated line) of each Polygon.

Author(s)

Mihai Valcu valcu@orn.mpg.de

References

Valcu, M., Dale, J. and Kempenaers, B. (2012) rangeMapper: A platform for the study of macroecology of life history traits. 21(9). (DOI: 10.1111/j.1466-8238.2011.00739.x)

See Also

coordinates.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
require(rangeMapper)
f = system.file(package = "rangeMapper", "extdata", "wrens", "vector")
# path to Campylorhynchus_gularis breeding range:
camgul = selectShpFiles(f, ogr = TRUE, polygons.only = TRUE)[6, ] 
r = readOGR(camgul$dsn, camgul$layer)
mp = vertices(r, mean)
v = vertices(r)

plot(r)
points(mp, col = 2, pch = 3, cex = 2)
points(v, pch = 3, cex = .5)