Lichfield District Council

Jump to content - Jump to navigation -

Making it easy to access council services, report problems in your area, view planning applications, find out what's going on locally, have your say on local issues, and much more.

Navigation

What can you do with our Open Data?

Since launching our Open Data catalogue almost a year ago, we’ve been continually adding new datasets, and even getting our data listed on data.gov.uk.

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):

http://www.lichfielddc.gov.uk/site/custom_scripts/wardsxml.php?postcode=[postcode]

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:

<wards>
<ward>
<name>Stowe</name>
<internal-id>16</internal-id>
<snac-id>41UDHE</snac-id>
<onsuri>http://statistics.data.gov.uk/doc/electoral-ward/41UDHE</onsuri>
</ward>
</wards>

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:

http://www.lichfielddc.gov.uk/site/custom_scripts/councillors_xml.php?viewBy=specificward&wardID=16

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):

http://www.lichfielddc.gov.uk/site/custom_scripts/wardskml.php?ward=41UDHE

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 stuart.harrison@lichfielddc.gov.uk

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

3 Responses to “What can you do with our Open Data?”

  1. [...] What can you do with our Open Data? >> Lichfield District Council Web Development BlogIncludes a “Find your councillors” walkthrough. [...]

  2. [...] What can you do with our Open Data? >> Lichfield District Council Web Development BlogIncludes a “Find your councillors” walkthrough. [...]

  3. [...] What can you do with our Open Data? >> Lichfield District Council Web Development BlogIncludes a “Find your councillors” walkthrough. [...]

Leave a comment