Mapping bike thefts at map.bikewise.org

We have a lot of open data. Maybe not Chicago quantities, but we've been the largest and most widely used stolen bike reporting service for years (which is why we recover stolen bikes!).

Getting our bike theft data onto a map is difficult—difficult enough that until now we just threw up our hands and hoped someone else would do it.

But Lyzi Diamond says maps are cool and that we should use them, so it's map time.

Example display of stolen bikes map - screenshot of map.bikewise.org

We wanted our map of thefts to be more than a pretty picture, to provide useful data visualization—with searching, browsing through time and links to the reports on Bike Index.

map.bikewise.org shows the 100 most recent thefts for the area you are viewing. It updates with new results every time you move the map, which has the neat effect of filling in more thefts as you zoom in.

You can search theft and bike data with the search bar—but searching doesn't move you to matching results. If you search and don't see anything, try zooming out.

The markers are colored according to the when the theft happened, the legend explains what the colors mean and you can click on time periods in the legend to to filter by them.

If you want to see more results, click on show 500 (slower) underneath the search bar. Clear all the markers with the clear map link if you get overwhelmed.


The making of

I'd never used Mapbox or leaflet.js before. They're both powerful, awesome tools and I'm glad to have had the opportunity to get to know them better.

Loading all the theft markers (> 28k) can overwhelm a browser/computer/internet, so I needed to dynamically load new points from the Bikewise API into the map as you moved around. This doesn't quite fit with the normal use case, so I had to come up with my own way of getting it done.

The easiest way I could think of to get the location every time the map changes was with the leaflet-hash plugin, which updates the URL with the location or zoom every time it changes. Also, it's cool and useful in its own right because it makes it possible to share the map location with a link (there still isn't a way to share the parameters that you set from the legend though).

I can say that without the Mapbox examples, tutorials and documentation, this map would be radically less interesting. They provided a great source not just for learning how to do things, but for inspiration and figuring out what was possible. I also owe a lot of thanks to their great support team, particularly Lyzi Diamond, who was incredibly patient with my bumbling questions.


And, of course, this code is all open source. You can find the mapping code at github.com/sethherr/biketheftsmap.