[Rspatial-devel] SpatialMultiPoints
Robert J. Hijmans
r.hijmans at gmail.com
Thu Aug 13 18:17:31 CEST 2015
Edzer, That's great. But why not make it more consistent with the
other classes by modifying SpatialPoints* such that it can have
multiple points per record; just like for SpatialLines and
SpatialPolygons? Would that guarantee to break too much; or perhaps be
too much work to avoid that? Robert
On Wed, Aug 12, 2015 at 8:43 AM, Edzer Pebesma
<edzer.pebesma at uni-muenster.de> wrote:
> The development version of sp, on r-forge, now provides objets with
> MultiPoint geometries, called SpatialMultiPoints and
> SpatialMultiPointsDataFrame.
>
> It can do things like:
>
> cl1 = cbind(rnorm(3, 10), rnorm(3, 10))
> cl2 = cbind(rnorm(5, 10), rnorm(5, 0))
> cl3 = cbind(rnorm(7, 0), rnorm(7, 10))
>
> library(sp)
> mp = SpatialMultiPoints(list(cl1, cl2, cl3))
> 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
>
> plot(mpdf, col = mpdf$a, cex = 1:3)
> as(mpdf, "data.frame")
> mpdf[1:2,]
>
> Comments are welcome.
> --
> Edzer Pebesma
> Institute for Geoinformatics (ifgi), University of Münster,
> Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
> Journal of Statistical Software: http://www.jstatsoft.org/
> Computers & Geosciences: http://elsevier.com/locate/cageo/
> Spatial Statistics Society http://www.spatialstatistics.info
More information about the Rspatial-devel
mailing list