I need to analyze data uploaded from vehicle GPS devices to detect travel patterns and then attempt to learn about the normal travel patterns for that vehicle so that predictions can be made about maintenance, refueling etc. Some vehicles are domestic (exhibiting normal home->work->home travel patterns) and some are commercial with scheduled routing. I have loaded the GPS lats and longs to a database, and then constructed an ST_LineString with the data points for each vehicle (approx 1k points per vehicle per day). Vehicles will never have identical travel patterns (GPS accuracy, irregular ping times etc) and the patterns will be visible as subsets of pings - for example a one hour commute between point A (home) and point B (work) between 8am and 9.30am each morning, mon-fri.

Now the difficult part - I am considering the options. I have to write this in a database procedural language using the usual toolbox of procedures, cursors, iteration etc. I could use Python if it is helpful - I'm a database guy trying to think laterally and spatially.

A travel pattern could be identified by

(i) a similar sequence of points that can differ by a tolerance (say +/- 300 meters)

(ii) parking locations - if a car is parked at the same location for 8 hours a day

(iii) temporal- the vehicle starts at trip at 0830 every day, +/- 10 minutes.

I am planning to write a procedure that checks for each of these patterns for each point (or set of n points) by comparing it with all other points (or set of points) by iterating through the pings for each day in sequence. The easiest use case is to find recurrences of a vehicle parked at the same place each day. Detecting similar movement patterns is more complex. Can anyone suggest a technique for this?


closed as too broad by underdark Dec 7 '14 at 22:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Clarifying what you need to know about travel "patterns" could help a lot. From what you write, it appears that you might only need to know the distance and perhaps the duration of each identifiable trip or segment of a trip: do you really need to compare the details of each route? Because automatically finding trip segments is a problem that has been addressed before (both here and on the Mathematica SE site), comparison of (distance, duration) pairs looks much more tractable than the difficult problem that you appear to be proposing. – whuber Dec 20 '13 at 14:13

From the differences in the coordinate values of the subsequent Points in your ST_LineString you could derive some information, like direction, distance between start and end point or whether it travels more or less on a straight line (differences in x and y direction remain the same over subsequent points) as well as the speed when timestamps for the points are given. you could for instance plot different parameters per track over time and then compare the plots.


As suggested, this is a problem that a few folks have solved before in various ways.

How about pre processing the data and only storing the stop points/journey start and end. An example algorithm for defining these stop points is DBSCAN. This link may be helpful: http://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html

Not the answer you're looking for? Browse other questions tagged or ask your own question.