The bus tracker shows bus position and route information from the Washington Metro Area Transit Authority (WMATA). It uses rails, and a significant body of javascript for google maps integration and asynchronous updates of bus positions without requiring an entire reload.
To run a server, you need Ruby and Ruby on Rails installed on your system. Instructions on installing these tools can be found here:
-
Install Ruby (1.9.3 or greater) www.ruby-lang.org/en/downloads
-
Install Ruby Gems (1.8.24 or greater) rubyforge.org/frs/?group_id=126
-
Install the rails gem (3.2.8 or greater): gem install rails
With rails installed, run the following steps
-
bundle install
This installs all the Ruby gems that bus-tracker depends on
-
bundle exec rake db:migrate
This configures the database schema
-
bundle exec rake populate:all
This fills the database with information on bus routes, bus stops, and current bus positions. It can take quite awhile to run, as there are many stops and routes in the system, and this all must be pulled from WMATA's servers.
-
foreman start
This starts the server with the web application thread, the clock thread that updates the bus data, and the worker thread that processes this data. This emulates a production environment.
-
Open a web browser and visit localhost:5000
Bus Tracker shows a map with WMATA bus routes and bus positions. Bus icon positions are updated as information is available from the WMATA servers. Updates don’t occur as frequently as desired; it’s typically between 2 and 5 minutes between updates for a specific bus. When new position information is retrieved, the bus icon bounces to highlight movement.
Bus icon transparency is modulated to indicate recency of display position information. After data is 5 minutes old, buses are displayed with transparent interiors. When position information is more recent, the fill becomes more opaque.
Bus icons are oriented according to the route direction (North, South, East, West).
A particular route can be focused on by clicking on that route, and clicking “Show Only Route X” in the top tool bar. Alternately, clicking on a bus shows an information window that also has a button which focuses the view on that bus’s route.
When a route is in focus, the stops on that route are displayed. When clicked on, these stops show an information bubble that lists the routes which stop there. The window is dynamically populated with predictions of wait times for buses to arrive at that stop.
Focus view can be exited by clicking the “Show All” button in the top toolbar.