Steve Holstad's "the bright lights"

"Just because your voice reaches halfway around the world doesn't mean you are wiser than when it reached only to the end of the bar." - Edward R. Murrow
in

WhereTheEL: Tracking the Chicago CTA "El" System

Try the WhereTheEL alpha

The past few weeks I have been spending some of my days creating a project we have discussed here at Clarity for quite some time: live tracking the trains of the Chicago "EL" system.  Currently GPS data is not yet available for individual trains, so we decided to leverage the growing community of active Twitter users to "crowdsource" this information.  A basic user scenario goes something like this:

Sweet Lou is standing on the platform of the Red Line's Addison station.  When his southbound train arrives, he hops on and pulls up a favorite Twitter client on his phone.  He sends a quick Twitter message directed to the WhereTheEL Twitter user: "@WhereTheEL Red Add S"  (red line, Addison, southbound).  Happy with contributing to the community, he cranks up "Go Cubs Go" and enjoys the ride.

Ozzie is in the loop, waiting at the Jackson station for a Red Line train.  In a hurry, he's not sure how long he should wait before catching a cab... so he pulls up the WhereTheEL site on his phone and is happy to see the image below.  Looks like a Red Line train is approaching the loop, so he skips the cab and waits for its arrival.

whereTheEl_Screen1

Building the App

The site checks in with its LINQ to SQL data context every thirty seconds to determine if/where any trains have been reported by Twitter users, and determines the trains' current positions.  On page load, the train routes are loaded from a kml file, and an overlay is created to draw the paths.  A second map overlay is created to display the collection of EL stations loaded from the database, with each object containing customized markup to display when the station marker is clicked.

The brain behind the site mentally walks the tracks, estimating where the train should be according to the last reported position.  The time between stations is calculated from the posted CTA schedules.  For each active train, a marker object is geocoded to the appropriate station.  In the scenario above, checking the site ten minutes after Lou reported seeing the Red Line would display a train approximately ten minutes past the Addison station.  Users can click on the train icons to view basic sighting information, and station icons to view CTA schedules.

In order to keep the map constantly updated, a windows service was created to access the Twitter REST API to retrieve any messages targeted at the WhereTheEL user.  These "replies" are then saved using LINQ to XML into message objects.  The messages are parsed to perform the lookups for train line, station and direction.  If a match is found, the object is inserted into the database via LINQ to SQL for mapping display on the web site.

popup1EL Train popup 

Detailed instructions on how to contribute are posted on the site:

Some future feature ideas:

  • Notifications: allow user to subscribe to line/station/time specific text notifications via Twitter Direct message
  • Host Google map control within AJAX Update Panel when supported
  • Silverlight conversion for animation of active trains
  • Ability to notify service regarding accidents/delays/etc
  • Create mobile application to leverage phones' GPS functionality (auto-reporting)
  • The bottleneck right now is the time from the Twitter Reply creation to availability in the API feed, so may need to find a more direct route (Twitter Direct messages)

Comments

chicago l line said:

Pingback from  chicago l line

# July 22, 2008 4:22 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)