My Canadian elections data visualisation project
Python Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
fed_res_2008.csv.zip
fed_res_2008.sql
fed_res_2011.csv.zip
fed_res_2011.sql
fedpolls.py
genKml.sh
kmlbig.txt
kmlcedric.py
kmlnormal.txt
kmlquebec.txt
parties.txt
pd308_a_2008.sql
pd308_a_2011.sql
pd308_p_2008.sql
pd308_p_2011.sql
updatewater.sh

README

Finally, I'm open-sourcing my Canadian elections scripts! I first wrote them in 2009, months following my involvement with CBC/Radio-Canada on the television coverage of the 40th general election in Fall 2008.

The project uses geographic data in Shapefile format from GeoGratis (http://geogratis.cgdi.gc.ca/geogratis/en/option/select.do?id=258D0E88-4C19-7DB1-41C2-0D0CF1CAF49C). I used postgis utility shp2pgsql to convert them for my database.

I mainly use libkml (http://code.google.com/p/libkml/), which has since 2010 been included in Ubuntu, my platform of choice for development.

fedpolls.py is the main file to generate KML files and was rewritten in summer 2011. kmlcedric.py is a library of common functions.

I provide the data too, even if you can get it elsewhere, except for the converted Shapefiles (too big for GitHub). There are SQL dumps (schema only) that create the tables needed. I formatted the results data too, which may be time-consuming otherwise.

You must also create a new column for the geometries called "the_geom_nowater" that is created by intersecting a cartographic version of the federal electoral districts (try googling it, it's on some govt website).

kmlbig.txt are IDs of ridings that must be generated with the water, because the watershores would make the files too big. kmlnormal.txt are the rest.

My personal blog contains information about the project:
http://smurfmatic.net/blog/

My portfolio:
http://cedric.sam.name/

I now reside in Hong Kong, where I work on data journalism projects relating to Chinese social media, at the Journalism and Media Studies Centre, University of Hong Kong:
http://jmsc.hku.hk/blogs/ricecooker/

(And I'm a masters student in Interaction Design at the School of Design, HK Polytechnic University! One of our projects: http://vimeo.com/21176300)

E-mail me for professional advice: cedricsam@gmail.com