What can you do with our Open Data?
However, after launching our latest lot of data, it’s occurred to me that we haven’t really given some solid examples of what people can do with this data, so here I’m going to talk you through a quick example of what you can do – I’m going to be as ‘code neutral’ as possible and only talk about the datasets used, rather than go into specifics about languages.
The project I’ve chosen is a ‘Find your councillors’ facility, allowing people to see who their councillor is, as well as see their ward boundary on a map.
Finding the ward
The first thing we need to do is find out what ward a postcode comes under, this can be achieved by using the ‘wards’ dataset (brand new as of today):
This returns the ward for a postcode, querying the UK-Postcodes webservice (disclaimer – I wrote this in my spare time) to get the ward Snac ID (the ID that the Office for National Statistics and other central government agencies use to identify a ward), and then querying our own databases to get the name of the ward and an internal ID. A sample response is below:
Getting the councillors
Armed with this we can then use the internal-id to get the councillors for that ward, in the case of Stowe (above), this would be:
We now have the councillor details for that ward, which we can then parse and display as we see fit. If you want to go mad, you can even display all the committees they sit on, and link through to the committe details, but for the purposes of this quick demo, we won’t
Showing a boundary
Finally, we want to display the ward boundary for our ward, now this is a brand spanking new dataset, obtained from the Ordnance Survey’s brand spanking new release of Open Data.
The original release was only available in ESRI shapefile format, which is pretty difficult to work with without the right software, so we’ve extracted the boundaries within Lichfield District (as well as Parish Council and County Electoral District boundaries) and republished them in a more web-friendly format (in this case, KML). To get the boundary for this ward, we take the Snac ID from step 1, and then make a request like so (again, using the ID for Stowe Ward):
We can now use whatever map service we want (whether it’s Google Maps, Bing or OpenStreetMap) to display the ward boundary on the map. I’ve used Bing, but you can use whatever you want.
The final product and the future
You can see the finished article here (obviously it only works with Lichfield District postcodes – there’s one added as default if don’t know one). It’s a bit rough and ready, but should give you some idea of the sort of things you can do with our data. We’re always adding to our datasets and like to think that we have a good releationship with local developers, so if you’ve got any ideas for new datasets, please let us know!
We’re also looking at arranging a hack day over the summer, so if you’re a developer and would like to get involved (whether you live in the district or not), please let us know, either in the comments, or get in touch direct at email@example.com
Edit: I’ve also added the code as a gist on GitHub if you’re interested
May 24, 2010 at 3:24 pm | web development | 3 comments