[prev in list] [next in list] [prev in thread] [next in thread]
List: r-sig-geo
Subject: Re: [R-sig-Geo] SpatialMultiPoints suggestions
From: Edzer Pebesma <edzer.pebesma () uni-muenster ! de>
Date: 2015-12-05 23:08:05
Message-ID: 56636E55.3090001 () uni-muenster ! de
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Thanks -- patch committed to r-forge.
On 05/12/15 22:37, Kent Johnson wrote:
> Hi,
>
> I am starting to use SpatialMultiPointsDataFrame to hold lat/lon/altitude
> data and metadata from airplane tracks. A couple of observations:
>
> - The documentation for SpatialMultiPoints {sp} seem to be incorrect. It
> say that the 'coords' argument is a "numeric matrix or data.frame with
> coordinates (each row is a point)". In fact the argument seems to be a list
> of such matrices, as shown in the example code.
>
> - rbind() is not implemented for SpatialMultiPoints*; perhaps it is an
> oversight, as the other Spatial* classes have implementations of rbind().
> Here is my attempt:
>
> rbind.SpatialMultiPoints <- function(...) {
> dots = list(...)
> names(dots) <- NULL
> stopifnot(identicalCRS(dots))
> SpatialMultiPoints(do.call(c, lapply(dots, slot, name="coords")),
> CRS(proj4string(dots[[1]])))
> }
>
> rbind.SpatialMultiPointsDataFrame <- function(...) {
> dots = list(...)
> names(dots) <- NULL
> sp = do.call(rbind, lapply(dots, function(x) as(x, "SpatialMultiPoints")))
> df = do.call(rbind, lapply(dots, function(x) x@data))
> SpatialMultiPointsDataFrame(sp, df)
> }
>
>
> HTH,
> Kent
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
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
["signature.asc" (application/pgp-signature)]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic