Ruby on Rails application to experiment with Google Maps/FusionTables
Ruby JavaScript CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A convenient web interface to the GPS track data gathered by the My Tracks application on the Android phone.


  1. Easily load ride data from Google Fusion Tables into a user’s account
  2. Display maps of all the user’s rides like this that can be easily browsed and searched
  3. Allow user to attach public/private notes to each ride
  4. Support for Metric and English units

The TODO list

  1. User feedback during ride import process
  2. Robust search/filtering capability (currently can only search by user ID)
  3. Show multiple routes on a single map
  4. More interesting and customizable aggregate statistics on rides
  5. Long term: provide a distribution of the elapsed time between two user-selected waypoints (across all the rides that went through those waypoints).

AJAX for ride import

  • Click 'Import Rides'
  • Request for list of ride ids that aren't in DB
  • "Status: getting new rides"
  • Spawn series of requests (batches of 5?) to import rides
  • "Status: importing rides"
  • Append new ride descriptions to page

Data Sources:

  • My ride spreadsheet
  • My fusion tables as well their Google Docs counterparts
  • The application’s database


  • User - has many Rides
  • Ride - belongs to a User

Implementation notes

Displaying the maps

  • Use the Google Maps Javascript API to create a Fusion Table layer (using the Fusion Table IDs from the user)
  • Find centerpoint and bounding boxes for map by parsing the ride data and using the geo_data gem.
  • Pass the necessary inputs to the javascript code by setting HTML attributes in the <div> element where the map will be inserted.

Getting up and running

  • bundle install
  • bundle exec rake db:migrate
  • bundle exec rake db:test:prepare
  • bundle exec thin start (for development use thin instead of webrick, works with the google auth)
  • edit /etc/hosts file
  • Postgresql is the DB, some helpful commands:
  • to install (on OS X): brew install postgresql
  • on Ubuntu, to create the databases: sudo -u postgres createdb db/test sudo -u postgres createdb db/development
  • to get status of server: pg_ctl status -D /usr/local/var/postgres/
  • to list available databases: psql -l
  • to process the background jobs that fetch Temperature data from Weather Underground: heroku run rake jobs:work Click on "Update Rides" in app (this puts rides without Temperature data on the queue)
  • Check out the startft.rb script for using GData::FusionTables interface
  • set client secret in config/initializers from

General Resources Good talk on using VI for Rails The nifty reg exp playground

Authentication Uses the Hybrid strategy (OpenID authentication of user + OAuth authorization for access to Fusion Tables) At 11:30 see how to override devise password required. < (background for omniauth)>
####A working example of using omniauth with Google as a provider.

  1. First, I Googled ‘providers in omniauth’
  2. using pry (cd OmniAuth::Strategies::Goo > tab complete to see all Google strategies)
  3. bundle open omniauth to look at the source code
  4. from a comment in the gems-open-id*google_hybrid file found this example, made by the person who wrote the provider

Google APIs

Ruby wrappers for APIs

Other How to set environment variables on Heroku. An updated version of table_builder that works on 3.1