Making tracks

December 12th, 2014

Here are some early results from my efforts to track transit vehicles, these ones in Toronto:

ttc-early-tracks

It looks like a crude system map, and it is, but it’s actually made of thousands of vehicle GPS tracks.

The vehicle tracks are oddly pretty; I keep wasting time just zooming in on different spots as new tracks are added. Here’s a transfer point at one of the subway stations:

transit station

Bus stops shown as ~20m circles

And what looks like perhaps a train station or a bus garage, below. This image also shows the relative frequency of service on different streets, something that becomes quite visible in the data when the lines are given a high degree of transparency.

bus garage?

Buildings for scale

And here’s an expressway carrying some limited-stop services:

expresswayAs of now, after just a week of  erratic development and testing, I’ve collected ~60,000 unique tracks, representing ~160 scheduled lines, derived from 3,200,000+ vehicle location records. About 50 new vehicle locations come in each second that I have my little script running.

Here’s what I’m doing so far, described algorithmically here, and implemented in a Python script:

A track is a set of ordered points, each point with a position and a time. The next step is to line the tracks up with the stop segments to which they’re scheduled, and if they’re actually close and the direction matches, to calculate stop times and segment durations from the observations. That’s actually turning out to be pretty difficult, but I’m sure I’ll crack it fairly soon. One thing I’ll have to seriously consider as I’m doing this is error in the location reports.

downtown signal degredationAs the first image and the one immediately above show, there is significant error in the data, particularly downtown where tall buildings are presumably interfering with GPS signal reception.

2 responses to “Making tracks”

  1. Farber says:

    How are you going to integrate subway locations? These aren’t on the map, are they?

    • Nate Wessel says:

      The subways don’t appear to be in the data. I want to find at least one other city to work with which does have real-time data for a substantial service in a transit ROW though, so I can make a comparison.