Skip to content
This repository has been archived by the owner on Nov 6, 2018. It is now read-only.

Postal code to Canadian federal electoral district web service (deprecated)

License

Notifications You must be signed in to change notification settings

opennorth-archive/postal_code_to_edid_webservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Postal Code to Electoral District Web Service

Dependency Status

NOTICE: This service is deprecated. Use Represent.

This service receives a postal code and returns the federal electoral districts matching the postal code as JSON. Since electoral districts change names regularly, we return the unchanging ID used by Elections Canada, which you can then map to a name.

Names are available at Elections Canada.

A postal code matching a single electoral district:

$ curl https://postal-code-to-edid-webservice.herokuapp.com/postal_codes/A1A1A1
["10007"]

A postal code matching multiple electoral districts:

$ curl https://postal-code-to-edid-webservice.herokuapp.com/postal_codes/K0A1K0
["35012","35025","35040","35052","35063","35064","35087"]

As JSONP:

$ curl https://postal-code-to-edid-webservice.herokuapp.com/postal_codes/K0A1K0/jsonp?callback=success
success([35012,35025,35040,35052,35063,35064,35087])

As CSV:

$ curl https://postal-code-to-edid-webservice.herokuapp.com/postal_codes/K0A1K0/csv
35012,35025,35040,35052,35063,35064,35087

An error for a nonexistent postal code:

$ curl https://postal-code-to-edid-webservice.herokuapp.com/postal_codes/H0H0H0
{"error":"Postal code could not be resolved","link":"http://www.elections.ca/scripts/pss/FindED.aspx?PC=H0H0H0&image.x=0&image.y=0"}

An error for an invalid postal code:

$ curl https://postal-code-to-edid-webservice.herokuapp.com/postal_codes/Z1Z1Z1
{"error":"Postal code invalid"}

This project uses GovKit-CA to determine electoral districts from postal codes. Credit to Daniel Haran for the first version of this project.

Copyright (c) 2011 Open North Inc., released under the MIT license

About

Postal code to Canadian federal electoral district web service (deprecated)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages