-
Notifications
You must be signed in to change notification settings - Fork 20
Home
Oct 7, 2013
See also http://rpubs.com/edzer/
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. Construction generates summary statistitics (length, nr of points, duration) but also segment properties (length, duration, speed,
direction; TODO are acceleration, curvature)
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 only need the appropriate over
method
over(Tr, geometry(Muenster))
to return the right indices (or indices list?).
It would be convenient to manipulate attributes directly:
Tr$log_pm10 = log(Tr$pm10)
we can now 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
but 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
cyclic time: diurnal pattern, weekly pattern, yearly pattern
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
after map matching (matching points to road segments), do we still represent location by points, or rather by e.g. the pair (road segment ID, distance from start of this ID)
- sparse trajectories, e.g. collected from fixed sensors (payments, traffic monitoring, etc); this requires conversion from what the sensor measures (times of passing the sensor: a marked temporal point pattern) to the path of an individual (trajectory)
- comparison across trajectories, (re-)identification of individuals, privacy
- classifying activities from movement
- clustering of tracks (trips), clustering of IDs (individuals)
- statistical models for trajectories (low-level: smoothing, high-level: identification, activity classificaiton)