Inferring bus routes from real-time data

22 views
Skip to first unread message

N

unread,
Feb 25, 2010, 1:18:07 PM2/25/10
to MassDOTDevelopers
MBTA's real-time bus location feed provides the positions of, what
seems like, all MBTA buses [1], but only includes route names for a
handful of routes. Despite this limitation, it is possible to infer
the route names for many of the buses by correlating the history of
bus positions with the route information available in MBTA's GTFS
dataset. A simple version of such an inference program is available
here:

http://kk.csail.mit.edu/~nickolai/bus-infer/

and the resulting mapping of bus vehicles to their route IDs is at:

http://kk.csail.mit.edu/~nickolai/bus-infer/vehicle-to-routename.xml

in a format very similar to the real-time feed itself (the above file
is updated every 10 minutes). Perhaps this will be useful to
developers of applications that use MBTA's real-time feed. As an
example, the following Google Maps mashup now shows the inferred route
names (wait about 10 seconds for the inferred route names to show up):

http://kk.csail.mit.edu/~nickolai/mbta-bus/map.html

There's a number of limitations to this simple inference program. It
doesn't infer route direction, might not distinguish bus routes that
run parallel for long periods of time (e.g. the 70 and 70A run the
same route for nearly 40 minutes, if you consider the inbound and
outbound legs put together, or the 1 vs. CT1), and probably will get
confused by buses that switched routes within the past 30 minutes (the
length of history considered by the program). Nonetheless, it seems
reasonably effective.

Nickolai.

[1] http://groups.google.com/group/massdotdevelopers/msg/d19e8f874f809d4f

DavidN

unread,
Mar 1, 2010, 8:33:09 AM3/1/10
to MassDOTDevelopers
That's fantastic :) My wife sometimes uses your map (through a phone
call to me) in the mornings to see when the 65 bus will arrive, and
I'd had to do it by guesswork and remembering numbers during page
updates until now - this morning I'd got all excited at realizing
there were route numbers and thought that the MBTA had expanded the
feed!

Still, that looks like an excellent substitute for now - I'll have to
play about with this and see if I can get some sort of simple "This
bus is X distance away arriving from the North"-style updates to work.
It might take the guesswork out of the largely fictional CT2
timetable :)

David

DavidN

unread,
Mar 2, 2010, 8:10:04 PM3/2/10
to MassDOTDevelopers
Nice touch with the multiple levels of certainly for routes as of this
morning! Just to check in again with my experience of using this for
the first time first-hand - it looks like the raw positions from the
MBTA feed are a little more delayed than I expected, as what I thought
was perfect timing from my workplace was just enough for me to see the
CT2 leaving from the Kendall/MIT station before I got there :) So for
predicting when to leave work, I think I need to wait for the MBTA to
expand the service to give us predictions for all buses as well.

However, after missing that bus, I decided to wait around with the
wireless Internet from the nearby bookshop, to watch the map as the
buses came past, and it was incredible being able to see them all as
they came in and matching up the bus ID numbers. Well, perhaps I'm
just easily amused, but the point is that it made me enjoy waiting for
an MBTA bus to arrive, and as far as I'm concerned, that's well into
Nobel Prize territory.

It's certainly proof that just knowing where a bus might be, and not
standing around in the cold with no certainty as to whether you'll
ever be picked up or not, improves the public transport experience to
an immense degree. Thanks again for putting it together.

David

Reply all
Reply to author
Forward
0 new messages