Tracking Heathrow with twitter

A few months back—while we were discussing the number of talking objects appearing on twitter—Jenny pointed out to me that all Heathrow airport arrivals and departures data is online. That set my mind racing, as if you know all the flights leaving that currently controversial airport, there are all manner of things you could begin to do. Working out miles travelled and carbon emitted, spotting delays, and so on. But at the time it all came down to a quick note in Things to some day set aside time to explore.

That day arrived this week. The data turned out to be pretty simple to scrape, with a quick wrapper around hpricot, and to throw into an SQLite database using datamapper to give me a little abstraction and a place to throw a variety of methods to make my code simpler. And then it was a small matter of employing John Nunemaker’s twitter gem to set up regular tweets letting followers in on how many flights in and out of Heathrow there have been lately.

The result is a rather pleasing hourly summary, that adds a little rhythm and background awareness into my day. You can follow it at http://twitter.com/heathrowtower.

Perhaps the biggest frustration with the data is that all destinations/origins are given as city names. Given that city names are hardly unique, and even if they were a given city may have several airports connecting with Heathrow, that makes it a bit trickier to do some of the more sophisticated calculations. My hope is that the flight codes (which are given) can soon be transformed into a list of airport codes, which can then open up a route to more useful and interesting data. (if anyone knows of an existing database that does that mapping, please let me know!)

I’m looking forward to that, but I’m also anticipating the ambient awareness that having the bot running will create. Will the hourly ritual of seeing a sentence or two about Heathrow activity reveal any patterns? If they do, maybe I’ll update the code to make more of those. We’ll see.

This entry was posted on Thursday, January 29th, 2009 at 11:32 am and is filed under Announcements, Snippets.
You can follow any comments to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.

2 comments

It’s a nice idea, but I’m not sure twitter is the right medium: it’s not sporadic like @towerbridge or @abovelondon. For example, would you be happy changing it so that it doesn’t send messages if there are no flights in or out during the hour you’re concerned with?

Still, it’s a good way to flush the data into the open, and figuring out flight codes, and hence distances / approximate passenger numbers, would definitely be very interesting.

I updated the code this morning so that if there haven’t been any flights in the past hour it notes “I’m having a rest” and if there haven’t been any in the past two hours it doesn’t tweet at all.

I’m considering developing that a little once I’ve got more data so that it can tell whether it’s normal to not have any flights at that time on that day. There are quite a few possibilities that are awaiting a bit more data.

I tend to like somewhat “rhythmical” tweets. I’m really enjoying David Lynch’s at the moment which happen about once a day, refer to the date and state the weather in LA. There’s something relaxing for me in the way that punctuates an otherwise erratic/sporadic medium like twitter.

That said, as more data emerges I am open to moving it off twitter and/or adding some other presence. Once I’ve got some mapping of flight codes to airport codes/co-ordinates a fairly obvious step is some sort of map interface, and there’d be other data visualisation options over time.

I'm James Stewart. I'm co-founder and Chief Architect at the Government Digital Service (part of the Cabinet Office) and deputy to the UK Government CTO. I led the technical team building GOV.UK, and before that the pilot Alpha.gov.uk.

You can find me on twitter and I've been known to post to a variety of other online spaces. A few links that put all of this stuff in more context can be found below.