looking for postal code:federal ridings

52 views
Skip to first unread message

wfrisch

unread,
Feb 12, 2011, 2:50:04 PM2/12/11
to VisibleGovernment Discuss
Looking for data mapping postal code to federal ridings.

We are building a petition site with PHP and mySql.

Any suggestion greatly appreciated

Henry Olders

unread,
Feb 14, 2011, 1:09:50 PM2/14/11
to visiblegover...@googlegroups.com
This site offers an API that allows users to look up their MP using postal code:
http://howdtheyvote.ca/api-info.php

Henry

> --
> You received this message because you are subscribed to the Google Groups "VisibleGovernment Discuss" group.
> To post to this group, send email to visiblegover...@googlegroups.com.
> To unsubscribe from this group, send email to visiblegovernment-...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/visiblegovernment-discuss?hl=en.
>

Andy.Kap...@ic.gc.ca

unread,
Feb 14, 2011, 1:38:28 PM2/14/11
to visiblegover...@googlegroups.com

That's something that rings a bell from the last round of the copyfight. Russell McOrmond worked on it -- check it out at http://www.digital-copyright.ca/edid

Michael Allan

unread,
Feb 15, 2011, 4:12:23 AM2/15/11
to VisibleGovernment Discuss
I have Ontario. I think the boundaries match the federal ridings, but
not sure: http://zelea.com/project/pollwiki/Tor/div/riding/_/postal/

The data might be stale, so see the links.

--
Michael Allan

Toronto, +1 416-699-9528
http://zelea.com/

Michael Mulley

unread,
Feb 14, 2011, 5:06:40 PM2/14/11
to visiblegover...@googlegroups.com, civicaccess discuss
This one gets asked a lot, so here's a slightly lengthy answer.

As Henry posted, your best option is Cory Horner's howdtheyvote.ca
API. It has a simple postal-code-to-MP call. I and lots of other
people have been relying on the service for a while; it's incredibly
useful.

However, even this service -- which Cory bought data for out of his
own pocket! -- is imperfect because of how expensive much of our
public data is. The data it uses represents postal codes as
"centroids" -- a single representative point for a given postal code.
The consequence of this is that it'll occasionally give you the wrong
answer, for example when a postal code contains addresses in different
ridings (it does happen!).

If you're really worried about accuracy, you can pay several thousand
dollars to Statscan for their data. Or you can go through the
following laborious procedure for each postal code (this assumes
you're getting postal codes from users on an interactive website):

1) Use Daniel Haran's postal code webservice at
http://postal-code-to-edid-webservice.heroku.com/ to get the ID of the
riding. This is a web service interface to a caching scraper of the
Elections Canada site. For problematic postal codes which don't
resolve cleanly to a riding, it'll return an error code.

2) If you get an error code, get a street address from the user,
resolve that address to coordinates using a geocoder, and submit those
coordinates to the howdtheyvote.ca API. I wrote some sample code for
this at vote.ca/api/ (using an alternate API).

This is complicated and painful. People are surprised at how
complicated and painful it is for developers to answer a simple
question like "who's my MP?". It would be far less painful, of course,
if certain public data -- the statscan postal-code-to-riding file,
geospatial data on postal codes -- were publically available. This
used to be the case in the UK -- see http://www.freethepostcode.org/
-- but their data has now been freed. Here's hoping that happens here
too.

Jonathan Brun

unread,
Feb 16, 2011, 10:03:48 PM2/16/11
to visiblegover...@googlegroups.com
hey,

one small idea - make people use their real names and photos - generate a beautiful petition with names and photos - i think it will have much more impact than your normal style text based petition. 

JB

+1 514.712.0637
EHSQ Reporter - Audit and Verify environment, health, safety and quality standards on mobile devices 
NimonikApp.ca Environmental Regulations Simplified
NimonikApp.ca Règlements environnementaux simplifiés
You should visit our environmental blog at: http://www.nimonik.ca/blog
















Reply all
Reply to author
Forward
0 new messages