[R-sig-Geo] space-time - efficient creation of a TracksCollection
Martin Tomko
martin.tomko at geo.uzh.ch
Wed Nov 18 14:55:04 CET 2015
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
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list