• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.


Capital Bikeshare SMS

Page history last edited by Harlan Yu 8 years, 10 months ago

Capital Bikeshare SMS

Problem Statement:

Capital Bikeshare is a public bikesharing program in the Washington DC area. It was created by DC’s Department of Transportation (DDOT) and Arlington County in Virginia, and is one of the largest bikesharing programs in the United States. The network currently consists of more than 1,100 bikes at more than 110 stations around the District.

Capital Bikeshare provides a Web-based station map, as well as Android and iPhone applications, that lets users discover the location of nearby stations and available bikes. This makes Bikeshare very convenient for those who own smartphones.

But for those with less-capable phones, taking advantage of Bikeshare is far more challenging—one may need to wander around to find the nearest station, only to find that no bikes are available at that station, or that the station has no docks available to return their bike.

The Solution:

Capital Bikeshare SMS is a service that makes it easy for residents without smartphones to use the Bikeshare program. Using the SMS service is simple: send an SMS to “41411” with the message “CAPBIKE” followed by any address or intersection in DC or Arlington. Within seconds, the service will send a reply SMS with the location of the two nearest Bikeshare stations, and real-time information about the number of bikes and docks available at each station.


1) The user sends an SMS to 41411 with the message “CAPBIKE 14th and U St NW, DC

2) The Capital Bikeshare SMS service replies with:

1. 14th & V St NW. 0 bikes, 17 docks
2. 16th & U St NW. 2 bikes, 13 docks

3) The user learns that the closest station at 14th & V St. has no bikes. So instead of going there, she walks two blocks to the 16th & U St. station to rent a bike. Win.

Try it for yourself!

How it works:

This SMS service is only possible because the the DC government has decided to publish real-time information about the Capital Bikeshare program. The structured XML feed of station locations and their current statuses can be found here.

The front-end SMS service is provided by TextMarks. TextMarks allows users to create a custom keyword and set HTTP callbacks to any URL whenever an SMS with the keyword is received. I chose CAPBIKE as the custom keyword for this service.

To handle the callbacks, I created a simple Google AppEngine application in Python. The application receives the callback with the address being queried, grabs and parses the real-time Bikeshare XML feed, calculates the location of the two closest stations, and returns the two locations along with their bike and dock availability. The application uses the Google Maps API to geocode the user-inputted address into a latitude-longitude pair, and uses BeautifulSoup to handle XML parsing.

Gluing all of these components together required writing fewer than 100 lines of Python code, and it took just over two hours to build. The code is free software under the GNU General Public License version 3 and can be found here.




I'm using TextMarks' free 14-day trial, so this service will end on October 8th, unless someone is willing to help pay for a TextMarks subscription (or some other SMS front-end service). 




Harlan Yu (harlanyu@cs.princeton.edu)

Capital Bikeshare SMS is not affiliated with the Capital Bikeshare program, DC’s Department of Transportation, or Arlington County, Virginia.



Comments (0)

You don't have permission to comment on this page.