Canada electoral results down to the polling station level

Almost a year ago, I created a web app that would generate Google Earth maps with electoral districts and present/past results. This same app was adapted for use on national television (my employer until recently) and again adapted for the provincial election in Quebec, two months after the federal one.

Recently, a new app created by well-known (small c) conservative blogger Stephen Taylor (see video here below) was brought to my attention. What Mr. Taylor brings is in fact a very important and interesting level of granularity to the results. Elections Canada raw data for polling stations has for a long time been made available to everyone. What wasn't originally available last year was geographical boundary of the territory covered by each polling station comprised in an electoral riding.

This data is now available along the electoral district data that I originally found on GeoGratis (a Canada Natural Resources website).

The format provided is Shapefile. My original system relied on a MySQL database that kept plain decimal coordinates of electoral districts. Now, I've learned more about spatial geography tools such as PostGIS (a PostgreSQL extension, and the premier way of storing purely geographical features) and geo libraries like GDAL. Using shp2pgsql, I imported the data of this Shapefile to my database. This is currently where I am at.

I think that from there I will be looking at ways to import the results data to my PostgreSQL db. Then, I'll try to use Google's libkml library (code in Python) for managing and creating KML data (which is just XML really).

Because the ridings data is so heavy, perhaps it will be difficult to make a web-based app with every single one of the 308 ridings.

Maybe if this project takes off, I will try to start my contributions project again, which has taken a rest for lack of editorial need.


, ,

Leave a comment

Type the characters you see in the picture above.

About this Entry

This page contains a single entry by Cedric published on August 14, 2009 3:24 PM.

Schema Magazine article was the previous entry in this blog.

Generating a KML with data from postgis and libkml is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.