Friday 25 February 2011

Mapping London's Bus Routes

Transport for London (TfL) have opened up a lot of their data over the last 18 months, with the first 1.4 million Barclays Bike journeys being one highlight (which allowed for visualisations like this, this and this) and a week's sample of Oyster card being another.

I've also been quite taken with other transport visualisations in the past, done by the likes of Flink Labs and using ggplot2 in R.


So here's my contribution to the transport network visualisation community - a bus route map of London, powered by Tableau Public. Enjoy. All copyright, etc. is to TfL. To see information about a particular route, just choose the route from the drop down and then click the update button in darker grey. Clicking that button again will show all the routes.



The geeky bit...
TfL are kind enough to provide the information for all their bus routes in an easy to read JSON format (as a by product of plotting a route on a google map), which when combined with a bit of code and information on all the routes in London (from londonbusroutes.net) enabled a relatively easy piece of scraping to get all the stop coordinates (you'll see that where a stop is around the corner from the previous one, there's a nasty diagonal line through a building).

The Oyster card data was much easier to get hold of, as TfL make it available to developers as a csv. I would normally put this straight into tableau and give full flexibility to do whatever analysis I wanted to, but Tableau Public is limited to 100k rows (the dataset has more than 1.5million rows in total and more than 700k for bus journeys). So I used R to create various summary statistics at route level - the day and time charts and payment method. I have to say that the data.table package is amazingly quick at aggregating data and proved a life saver to get the data at the right level.

Sunday 13 February 2011

One word... yikes!

I'm doing one of the two amateur stages of the Tour de France in July (known as L'Etape) which is a one-day, 205km cycle over part of the Massif Central from Issoire to Saint-Flour.

Training for that to date has been a fair amount of spinning at Virgin Active and cycling at the weekend around Richmond Park. This weekend was the first venture into something longer and challenging at one of Evans Cycles Ride It! sportives, which started and finished in Esher, Surrey.

To get an idea of how this compared to L'Etape, I used the excellent gpsvisualizer.com which, amongst other things, can convert KML files (this is what Google uses to plot tracks, etc. on maps) to GPX files (which can be read by GPS systems), but can also plot the elevation profile of a route.

The chart below shows three routes: L'Etape in green, the Evans route in red and my typical Richmond Park jaunt in blue. One word, yikes!