Skip to content
edzer edited this page Oct 7, 2013 · 17 revisions

Status of trajectory analysis

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

selection on trips/tracks

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.

simple manipulation of attributes

What we can't do yet

Tr$log_pm10 = log(Tr$pm10)

coercion:

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

aggregation:

aggregate(Tr, "1 hour", mean) # compute 1-hourly mean attributes, change of geometry
aggregate(Tr, Muenster, max) # compute max of attributes, change geometry

plotting

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?

Analysis

  1. interpolation: predict trajectory values e.g. at exact 1-minute or 1-hour values
  2. smoothing: predict the true location, using some error model for the GPS reading -> gives interpolation
  3. constrained smoothing: map matching
  4. sampling: random, or systematic sampling (thinning)
  5. generalization: retain a smaller number of points, loosing as little as possible information
Clone this wiki locally