Here’s my application for discovering Capital Bikeshare (CaBi) locations, and the availability of bikes and empty docks. I was inspired to build CaBi Mapper after the Bike Shops and Beyond project, which was populated with coordinates for a variety of businesses and services, including CaBi locations.

The data came from Capital Bikeshare‘s bikeStations.xml file, which is constantly updated as bikes are checked out and returned. It includes latitude and longitude, so mapping is easy. PHP lets you read in the entire XML file with a single function, simplexml_load_file. I used the Google Maps JavaScript API v3 to draw the map (with help from OpenStreetMap).

Once the data is available, the rest of the project is designing the user interface. I chose to go with pie charts to show the ratio of available bikes to empty dock slots. Red (matching the color of the bicycles) is used to represent available bikes, and dark blue represents free spaces. Hovering over a marker displays the exact number of bikes and slots, as well as the location. Clicking on the marker will zoom in and pan to the center, and display an information window with the location, availability statistics, and the date and time that a change was last reported, meaning the last time a bike was either taken or returned.

The “activity” button lets you explore a different set of data for the same stations. This time the pie charts reflect how long it’s been since each station has seen any activity. The ratios are normalized to span the maximum and minimum update times for the stations currently displayed in your view port. You can recalculate the distribution after you pan or zoom the map. The more-yellow stations had check-ins or -outs more recently than the more-black stations.

You can hit the “A” button to toggle between activity and age. “Age” mode uses green-and-brown charts to show the relative age of each station, based on when it was installed.

Note the data is static. In this first version, to get new CaBi stats you have to refresh your browser.

The CaBi Mapper app works in your browser, and scales for desktop or mobile devices. If your browser supports geolocation, you’ll see a “locate me” button which will zoom the map to your location.

The app is at Your comments and suggestions are welcome.

CaBi Mapper: Bikeshare Availability & Activity

2 Responses to “CaBi Mapper: Bikeshare Availability & Activity”