VoteUK - Some Progress!
As you may recall from previous instalments of my thrilling blog, I'm trying to find the location of every polling station in the UK.
This is proving to be rather tricky - if not impossible. The data aren't centrally held and, in any case, polling stations aren't announced until an election is called.
So I went for the next best thing. Using the wonderful What Do They Know site to make a Freedom of Information Act request, I asked the Electoral Commission for details of every council and which postcodes they cover for elections.
I'm delighted to say that, after a friendly chat with the very helpful Iredia Oboh I now have the data I need!
Check out the nearly finished VOTEUK.
I have a table listing every one of the 17 million postcodes in the UK. Each postcode has a "Council ID".
I have a table listing every Council with their contact details and their "Council ID".
Using the joy that is MySQL I can take a postcode and find the details of the Council who administer elections in that area.
$query = "SELECT Council_ID from postcode_councilID WHERE postcode = '". $postcode . "'"; $result=mysql_query($query); $row = mysql_fetch_array($result); $council_id = $row["Council_ID"]; $info_query = "SELECT * FROM councils WHERE Council_ID = " . $council_id; $info_result=mysql_query($info_query); $info_row = mysql_fetch_array($info_result);
So, I can take W1A 1AA and find that it's administered by Westminster Council, their email address, phone number and postcode.
The data can be found on the FoI request. Note that the CSV files are in UTF-16. You may wish to convert them to UTF-8 or ASCII depending on what you will be doing with the data.