geomToCoords: Extract vertex points from spatial polygon or lines object

Description Usage Arguments Value See Also Examples

View source: R/geomToCoords.r

Description

This function extracts coordinates of vertices of a polygon or line from a SpatialPolygon, SpatialPolygonDataFrame, SpatiaLines, or SpatialLinesDataFrame.

Usage

1
geomToCoords(x, n = NULL, out = "matrix", removeClose = TRUE)

Arguments

x

SpatialPolygon, SpatialPolygonDataFrame, SpatiaLines, SpatialLinesDataFrame, SpatialPoints, or SpatialPointsDataFrame.

n

NULL or positive integer(s) indicating which sub-polygon(s) or line(s) to extract. The default NULL is to extract points for all vertices of all sub-geometries. To see the number of sub-polygons or lines in an object use countSubGeoms. This is ignored if the object in x is a SpatialPoints* object.

out

Character, either 'matrix' (default) or 'pts', indicating the returned object should either be a matrix with coordinates (default) or an object of class SpatialPoints

removeClose

Logical, if TRUE (default), then remove the last pair of coordinates (for polygons only–ignored if lines). Most spatial polygons have the same set of first and last coordinates to complete the polygon.

Value

A two-column matrix or a SpatialPoints object.

See Also

countSubGeoms, subGeom

Examples

1
2
3
4
5
data(mad0)
island <- subGeom(mad0, 1)
pts <- geomToCoords(island, 1)
plot(island)
points(pts)

adamlilith/birdsEye documentation built on May 23, 2020, 4:40 p.m.