SpatialMultiPoints {sp} | R Documentation |
create objects of class SpatialMultiPoints or SpatialMultiPointsDataFrame
Description
create objects of class SpatialMultiPoints-class or
SpatialMultiPointsDataFrame-class from
coordinates, and from coordinates and data.frame
s
Usage
SpatialMultiPoints(coords, proj4string=CRS(as.character(NA)), bbox = NULL)
SpatialMultiPointsDataFrame(coords, data,
proj4string = CRS(as.character(NA)), match.ID, bbox = NULL)
Arguments
coords |
list with in each element a numeric matrix or data.frame with coordinates (each row representing a point); in case of SpatialMultiPointsDataFrame an object of class SpatialMultiPoints-class is also allowed |
proj4string |
projection string of class CRS-class |
bbox |
bounding box matrix, usually NULL and constructed from the data, but may be passed through for coercion purposes if clearly needed |
data |
object of class |
match.ID |
logical or character; if missing, and |
Value
SpatialMultiPoints
returns an object of class SpatialMultiPoints
;
SpatialMultiPointsDataFrame
returns an object of class SpatialMultiPointsDataFrame
;
See Also
coordinates, SpatialMultiPoints-class, SpatialMultiPointsDataFrame-class
Examples
cl1 = cbind(rnorm(3, 10), rnorm(3, 10))
cl2 = cbind(rnorm(5, 10), rnorm(5, 0))
cl3 = cbind(rnorm(7, 0), rnorm(7, 10))
mp = SpatialMultiPoints(list(cl1, cl2, cl3))
mpx = rbind(mp, mp) # rbind method
plot(mp, col = 2, cex = 1, pch = 1:3)
mp
mp[1:2]
print(mp, asWKT=TRUE, digits=3)
mpdf = SpatialMultiPointsDataFrame(list(cl1, cl2, cl3), data.frame(a = 1:3))
mpdf
mpdfx = rbind(mpdf, mpdf) # rbind method
plot(mpdf, col = mpdf$a, cex = 1:3)
as(mpdf, "data.frame")
mpdf[1:2,]