An image created by Seth Kadish at Vizual Statistix caught my eye in my Twitter timeline yesterday showing road orientation distributions (i.e. what directions the roads go in) for a number of US cities. Being British, the idea of roads forming a nice, thought-out pattern is completely alien to me and takes all the fun out of trying to get lost but the visualisations intrigued me none the less. The calculations used by Seth had a few limitations as the length of each street didn’t influence the plot and a twisty street would only register in a single orientation rather than being split appropriately. So time to step up to the plate to see if I can find a more interactive and representative way of doing the same thing.
Try it out
For those wanting to get straight to the action then here’s the link: veloviewer.com/roads
Getting the data
Fortunately as well as providing raster (image) tiles for their maps, OSM (Open Street Map) can also provide vector maps which break down each road into small chunks of straight road that are joined together to make the full map for a given tile. Pulling in that data for a chosen map and I’ve got the data for a huge collection of bits of road. Rounding those up to the nearest 5 degrees and summing the actual distances for each chunk and hey presto, an accurate distribution of road orientation distances! Rendering them out using a bit of d3 magic and ther you have it.
Just drag the map around and zoom in and out as required to get the plots for anywhere in the world.