In preparing for the 2011 Provincial election I realized it would be convenient to work with the riding and poll boundaries from Elections Ontario as I have already done with the GIS data from Elections Canada. Each organization has published "shapefiles" but for online applications KML is the standard data format. So the first step then is to convert the ESRI shapefiles converted to Google's KML format.
I'm a supporter of the open source movement so I'm making the KML/KMZ files available to everyone. If you're interested in the details see below for the conversion steps. But if you want to skip right to creating online applications feel free to start from the KML below.
Leave a comment if you get an application online - I'm always curious to see where ideas and collaboration lead to.
Download- All riding boundaries in a single KMZ.
- All poll boundaries in a single KMZ (big file!).
- Individual riding boundaries.
- All poll boundaries in a single riding.
ESRI Shapefiles to KML Cheat Sheet
- Download the ESRI Shape files from Elections Ontario.
- Ubuntu 10.04 is my baseline. My first attempt was on Ubuntu 8.? but libgdal is too old (1.5.X). The latest Ubuntu has gdal 1.6.X and that makes a difference.
- apt-get install gdal-bin libproj-dev
- ogr2ogr -f KML -t_srs 'EPSG:4326' all_ed.kml EO_107ED.shp
- ogr2ogr -f KML -t_srs 'EPSG:4326' all_pd.kml PD_107.shp
You can also generate per-riding KML files using a select clause (substitute XXX for an electoral district)
- ogr2ogr -f KML -where "ED_ID = XXX" -t_srs 'EPSG:4326' ed_XXX.kml EO_107ED.shp
- ogr2ogr -f KML -where "ED_ID = XXX" -t_srs 'EPSG:4326' pd_XXX.kml PD_107.shp






