[R-sig-Geo] space-time - efficient creation of a TracksCollection

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Nov 18 22:16:12 CET 2015


Hi Martin, such a function would be a nice addition to the trajectories
package, and shouldn't be too hard to write. Maybe you can come up with
a short example csv data set?

library trajectories has two demo's, demo(Geolife) and demo(google),
which read the Geolife data set and google location history json dumps
to trajectories, but both are overly complicated for what you have in mind.

The selection you want to do on object and ID can be done on the
data.frame level, e.g with subset().

The function to write will use split to split the data.frame in a list
with sub-data.frames, and lapply to apply functions to list elements.

On 18/11/15 14:55, Martin Tomko wrote:
> Dear list, cc Edzer,
> 
> I am trying to find an efficient method to read in data into a
> library(spacetime) TracksCollection, from a large CVS containing gps
> tracks of individual objects.
> 
> I have managed to do this for a small number of tracks, following the
> documentation, using a spatialPointsDataFrame spdf:
> 
> stidf = STIDF(geometry(spdf), spdf at data$timestamp, spdf at data)
> T1 = Track(stidf)
> 
> etc for a number of Tracks, then mergins individual Track objects into
> Tracks for a given user
> 
> O1 = Tracks(list(T1=T1,T2=T2))
> 
> and then making a collection
> Tr = TracksCollection(list(O1=O1,O2=O2)) of individual objects
> 
> Now - this is very cumbersome. I have potentially thousands of objects
> tracked, each with a number of tracks. They are all stored in one large
> CSV annotated by timestamp, objectid and trackid. Is there any efficient
> method to parse (even thorugh any other sp object) collections? The
> manual assignment of o1= o1, o2=o2 etc is the main problem, from my
> perspective. I would like to supply a vector of names of users, and a
> list of names of tracks (each are unique in the whole set) to this.
> 
> I can loop through the list of data frames for each individual Track
> before they are coerced into spatialPointDataFrame, and I can get the
> additional labels - I see this as a way to append a new STI to
> appropriate Tracks and to the collection?
> 
> Any hint welcome.
> 
> Thanks,
> 
> Martin
> 
> 

-- 
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20151118/7556f068/attachment.bin>


More information about the R-sig-Geo mailing list