[R-sig-Geo] space-time - efficient creation of a TracksCollection
Martin Tomko
martin.tomko at geo.uzh.ch
Thu Nov 19 12:28:18 CET 2015
Dear Edzer, cc list,
thanks for your feedback, that sounds like a good suggestion - that was also my thinking.
I have managed to do the rest up to the splitting without troubles in the past few days. The splitting is a problem with large datasets - it seems that forming a list of df take a lot of memory (probably some objects overhead). Nevertheless, it works up to some extent.
I have resorted to use dlply ( at least it completes, while split fails has troubles with the size of my data, and bigsplit did not work for some reason).
I am still not sure how I would deal with the manual assignment of the
>> O1 = Tracks(list(T1=T1,T2=T2)
and similar for the TracksColleciton. While I have a function that can be lapply-ied to each sub-df to create an STI object and a Track, I have no idea how to deal with the naming of the objects in Tracks or in the collection. Maybe if there was a constructor to pass it the list of Track/Tracks respectively, along with a vector of names, that could be ziped together?
I will generate a small sample csv to support our discussion further and send it to you.
Thanks,
Martin
On 18 Nov 2015, at 22:16, Edzer Pebesma <edzer.pebesma at uni-muenster.de> wrote:
> 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
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list