-
Notifications
You must be signed in to change notification settings - Fork 20
Home
edzer edited this page Oct 7, 2013
·
17 revisions
Oct 7, 2013
A single trip is a Track
object, a set of (cohering) trips is a Tracks
object, Tracks
for different IDs (persons, cars, devices, individual animals) are in TracksCollection
objects
What we can do:
Tr[1:2] # returns a TracksCollection, and
Tr[2] # returns a Tracks object
Tr[2][1] # selects a Track object
selects the first two IDs; what we can't do yet:
Tr[list(1:2, 2:3)] # to select the first two trips from ID1, and trip 2 and 3 from ID2.
Tr[Muenster] # select those tracks that cross (object) Muenster
For the latter, we basically need a
over(Tr, geometry(Muenster))
to return the right indices.
What we can't do yet
Tr$log_pm10 = log(Tr$pm10)
we can already do
as(Tr, "data.frame") # convert to data.frame, trips separated by an NA record
as(Tr[1], "data.frame") # convert Tracks
as(Tr[1][1], "data.frame) # convert Track
as(Tr, "segments") # like data.frame, but record for each segment with all x0 y0 x1 y1 segments, and segment attributes
we still need:
as(Tr, "xts") # convert to time series
as(Tr, "STIDF") # convert to spatio-temporal points
as(Tr, "SpatialLines") # convert trips to SpatialLines, aggregate() would aggregate attributes
as(Tr, "SpatialPointsDataFrame") # simply "dump" as points with attributes
aggregate(Tr, "1 hour", mean) # compute 1-hourly mean attributes, change of geometry
aggregate(Tr, Muenster, max) # compute max of attributes, change geometry
plot(Tr)
stplot(Tr)
stplot(Tr, attr = "elevation", by = "direction")
both work, and can do sth useful, but only work for SpatialPoint geometries; if we aggregate to lines (e.g. road segments), they probably don't. TODO: all special cases, or more generic code?
- interpolation: predict trajectory values e.g. at exact 1-minute or 1-hour values
- smoothing: predict the true location, using some error model for the GPS reading -> gives interpolation
- constrained smoothing: map matching
- sampling: random, or systematic sampling (thinning)
- generalization: retain a smaller number of points, loosing as little as possible information