Skip to content

cedricsam/Canada-Elections

Repository files navigation

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

About

My Canadian elections data visualisation project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published