Fun With Citibike and Mapbox

js, mapboxgl-js

citibike mapbox project

Oct 21st, 2021

I’ve been studying a lot of React code using mapbox, and wanted to see if I could make something of my own in javascript. I envisioned a tool that could be used before hopping on a citibike to check if a nearby dock actually has bikes available, and if your destination is also near a station with docks available. I have been spurned before by a completely full citibike station before, so I can attest to the usefulness. This app is not complete yet, but so far you can look up a location and see what the nearby stops are, and whether they have docks or bikes available.

Citibike has a GBFS feed that you can pull station data from. The bike/dock number info is in a separate json file than the station location info, so some mapping had to be done . Right now I'm just using a for-of loop to loop over the station status array and pull the relevant data for the station.

Mapbox has been fun to play around with. The plugins are great, it makes it very easy to add things like geocoders (the location search box) and do more complicated calculations with Turf. I spun the current version of this app up in one day using their examples and tutorials. I will continue to update this page as I update the app.

Look up some locations here!

See my code on github.