ReRoute.it
TranspoChoices is all about making better transportation choices. However, our calculations are only approximations and should be treated as such.
Installation
You'll need an API key for Bing maps.
Get one at bingmapsportal.com, then set an environment variable
in your .bashrc
or .bash_profile
like so:
export BING_KEY="your-bing-api-key"
Ruby 1.9.2 or greater is required to run this app. Install ruby, then:
gem install bundler
git clone [email protected]:codeforamerica/transpochoices.git
cd transpochoices
bundle install
bundle exec rackup
Open your web browser to localhost:9292
Continuous Integration
API
/info_for_route_bing?origin=<>&destination=<>
Example:
info_for_route_bing?destination=88%202nd%20%20st,%20san%20francisco&origin=563%2046th%20st%20oakland
Returns:
{
"units": {
"distance": "kilometers",
"duration": "seconds",
"emissions": "milliliters of innocent bunny blood",
"cost": "usd",
"calories": "calories"
},
"results": {
"driving": {
"distance": 15.943,
"duration": 900
},
"walking": null,
"transit": {
"duration": 2427,
"while_walking": {
"distance": 1.872,
"duration": 1347
},
"while_transit": {
"duration": 1080
}
}
}
}
Deploying
Deployment is easy on Heroku.
heroku create your-app-name
git push heroku master
heroku config:set BING_KEY=your-bing-key
Assumptions
Walking
Cost - Always rounding to $0
Time - Calculated by Bing Walking Routes API
Calories - Using this table, assuming a 160lb individual
CO2 Emissions - Always rounding to 0
Biking
Cost - $0.115 per mile
Time - Calculated by Bing Walking Routes API, then extrapolates biking time
Calories - Assuming 30km/h and 24 calories/km
CO2 Emissions - Always rounding to 0
Transit
Cost - Uses fare data in the GTFS specification (SF Muni and BART only)
Time - Calculated by Bing Transit Routes API
Calories - Calories burned while walking to transit, then 1.4-1.7 calories per idle minute
CO2 Emissions - 0.65 pounds of CO2 per passenger mile - assuming bus transit
Taxi
Cost - Uses scraped taxi rates
Time - Calculated by Bing Driving Routes API
Calories - 1.4-1.7 calories per idle minute
CO2 Emissions - 0.96 pounds of CO2 per passenger mile - assuming single occupancy vehicle
Driving
Cost - Uses $0.585, the 2011 AAA average cost per mile
Time - Calculated by Bing Driving Routes API
Calories - 1.4-1.7 calories per idle minute
CO2 Emissions - 0.96 pounds of CO2 per passenger mile - assuming single occupancy vehicle
Who Made This?
TranspoChoices was lovingly made by Code for America fellows Aaron Ogle and Talin Salway, with design work by Pete Fecteau. Feel free to send feedback to aaron [at] codeforamerica.org.
This is cool. Can I help?
Sure! TranspoChoices is an open-source project and we're looking for people with all kinds of talent to get involved.
Contributing
In the spirit of free software, everyone is encouraged to help improve this project.
Here are some ways you can contribute:
- by using alpha, beta, and prerelease versions
- by reporting bugs
- by suggesting new features
- by writing or editing documentation
- by writing specifications
- by writing code (no patch is too small: fix typos, add comments, clean up inconsistent whitespace)
- by refactoring code
- by resolving issues
- by reviewing patches
Submitting an Issue
We use the GitHub issue tracker to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. You can indicate support for an existing issuse by voting it up. When submitting a bug report, please include a Gist that includes a stack trace and any details that may be necessary to reproduce the bug, including your gem version, Ruby version, and operating system. Ideally, a bug report should include a pull request with failing specs.
Submitting a Pull Request
- Fork the project.
- Create a topic branch.
- Implement your feature or bug fix.
- Add documentation for your feature or bug fix.
- Run bundle exec rake doc:yard. If your changes are not 100% documented, go back to step 4.
- Add specs for your feature or bug fix.
- Run bundle exec rake spec. If your changes are not 100% covered, go back to step 6.
- Commit and push your changes.
- Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
Supported Rubies
This library aims to support and is tested against the following Ruby implementations:
- Ruby 1.9.2
- Ruby 1.9.3
Copyright
Copyright (c) 2011 Code for America Laboratories See LICENSE for details.
~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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