[R-sig-Geo] How to create a SpatialMultiPoints object
Stefan Jelkovich
stefjelko at gmail.com
Sun Apr 13 20:36:09 CEST 2014
Hi all,
I’m struggling with the creation of a SpatialPoints/SpatialPointsDataFrame object containing MultiPoints. Is this possible at all?
# SinglePoints are that easy:
library(sp)
data(meuse)
coordinates(meuse) <- ~x+y
# MultiPolygons are that easy:
p1 <- Polygon(cbind(x=c(0, 0, 10, 10, 0), y=c(0, 10, 10, 0, 0)))
p2 <- Polygon(cbind(x=c(13, 13, 17, 17, 13), y=c(13, 17, 17, 13, 13)))
lp <- list(p1, p2)
pls <- Polygons(lp, ID="1")
mp <- SpatialPolygons(list(pls))
How can I put all the meuse data points in one MultiPoint object?
Stefan
More information about the R-sig-Geo
mailing list