postal code to City Ward

874 views
Skip to first unread message

Oliver Zielke

unread,
Nov 23, 2009, 12:37:19 PM11/23/09
to DataTO
Hi folks,

I work for non-profit IT provider Web Networks, and am looking for a
postal code to City ward database enabling end user to find their ward
by entering their postal code. Anybody have such information. Below is
the response from Open Data--city says "No, Canada Post won't let us
give that away"

Begin forwarded message:

From: "Open Data" <open...@toronto.ca>
Date: November 23, 2009 12:24:22 PM EST
To: "Oliver Zielke" <oli...@web.net>
Subject: Re: postal code to city ward

Oliver,

Based on the agreement that was recently signed with Canada Post, we
do not have permission to release the postal code field. Management
is going
to discuss our terms of usage with Canada Post and perhaps in the near
future we can include it, but for now we cannot.

Regards

Philip

>>> Oliver Zielke <oli...@web.net> 11/20/2009 5:23 PM >>>
Hi Trish

Any progress on obtaining this data? Is it available

You may have seen this news

http://www.guardian.co.uk/technology/2009/nov/19/ordnance-survey-maps-free-online

Thanks

Oliver

Oliver Zielke, Executive Director
http://web.net
W: 416.596.0212 x.25 | M: 416.898.5850



On Nov 4, 2009, at 2:38 PM, Open Data wrote:

Hi Oliver,

Thank you for your query about postal codes tied to City wards. We
will get back to you as soon as possible.

Regards,
Trish

City of Toronto |Toronto Open | Philip Scott, Open Data Project
Manager | Trish Garner, Manager, Web Strategy > toronto.ca/open |
open...@toronto.ca


From: Oliver Zielke <oli...@web.net>
To: <open...@toronto.ca>
Date: 2009-11-02 10:07 am
Subject: postal code to city ward

Hello,

I work for Web Networks, a non-profit organization based in T.O.

We are interested in accessing a database of postal code to city of
toronto ward. Is that available?

thanks

Oliver

Oliver Zielke, Executive Director
http://web.net
W: 416.596.0212 x.25 | M: 416.898.5850




Geoffrey Wiseman

unread,
Nov 23, 2009, 4:59:11 PM11/23/09
to dat...@googlegroups.com
On Mon, Nov 23, 2009 at 12:37 PM, Oliver Zielke <ozi...@gmail.com> wrote:
Hi folks,

I work for non-profit IT provider Web Networks, and am looking for a
postal code to City ward database enabling end user to find their ward
by entering their postal code. Anybody have such information. Below is
the response from Open Data--city says "No, Canada Post won't let us
give that away"

Seems like you could derive that from the geolocation service (which allows you to search by postal, from what I've read) and the ward data.  Someone with a stronger GIS background might be able to give you a more detailed response.
 
  - Geoffrey
--
Geoffrey Wiseman
http://www.geoffreywiseman.ca/

Marcel Fortin

unread,
Nov 23, 2009, 11:12:16 PM11/23/09
to dat...@googlegroups.com
The easiest way to do it would be to build a google map and overlay the
ward boundary file (converted to KML). A user could then query the map
with their address and at the very least visually see which ward they
live in.

I don't know of another free way of doing it other than in desktop GIS
software where one could geocode the addresses (assuming you don't have
just postal codes) and then overlay the ward boundaries. Then, doing a
spatial query/join, you could easily attach a ward to each postal code.

Since postal codes are a commercial product, I don't think anyone could
actually build a service that could do this online without having to pay
for them. Geocode.ca API for instance charges $1.00 for 400 lookups.
Canada Post and DMTI Spatial also charge for access to postal code files.

Another option is purchasing the Census Tract - Postal Code
correspondence file (i'm assuming it's cheaper than the postal code
files but I'm not 100% sure). You would then at least be able to
aggregate the census tracts to wards since they use the same boundaries.
You could then have postal code queries match an actual ward rather than
a census tract.

Marcel

Louis St-Amour

unread,
Nov 24, 2009, 12:52:39 AM11/24/09
to dat...@googlegroups.com
If you just need a rough estimate, or if postal code outlines happen to match up to ward data (who knows), here's the GTA's postal code boundaries (for the first half of the postal code): http://www.canadapost.ca/cpc2/addrm/hh/maps/FSA/ON20.pdf (what they call urban Forward Sortation Areas)

Um ... just in case people here didn't know, Safari on the iPhone is now not the only browser to support Geolocation -- take a look at Firefox 3.5 with Google's Wifi geolocation: https://developer.mozilla.org/En/Using_geolocation

There's some old data from maybe 2005 at http://code.google.com/p/python-geolocate/source/browse/#svn/trunk ... no idea what the official license of the /data/ is. I've seen it in four other places online based on a search for POSTAL_CODE_ID and such. No license listed on any of them.

In theory, this service does exactly what you want and might be all you need: http://www.toronto.ca/open/datasets/geocoder-web-service/ In the last 10 minutes, I kept getting errors with an online SOAP testing tool, but http://map.toronto.ca/ easily located my ward (8, York West) when I typed in my street address, so I can't imagine the SOAP version, with findByPostalCode and findByPostalCodeWithVotingLocation to be that much different. I could be misunderstanding this.

As an alternative, if any provided data set includes postal codes, those could be used to map out a rough, hazy version of the FSA maps, especially useful if one pays close attention to ward boundaries only.

Louis.

Louis St-Amour

unread,
Nov 24, 2009, 2:24:13 AM11/24/09
to dat...@googlegroups.com
As a followup, I'm a little peeved at the addressing data set at http://www.toronto.ca/open/datasets/address-points/ unless someone can set me straight -- It says:

All address points have a position, they are attributed with an identification number that is unique over time and over the city, with a feature code that defines property use, with the information source and the information accuracy, with the date the point was entered into the asset and the date it was removed from the current asset to the archival asset and also where known the postal code. Points are further attributed with a municipal address number or a municipal address name, such as CN Tower or both. Additionally the address number may be suffixed by a letter or may be a range of numbers. Every address point is linked to a linear feature from which the street name is determined. Every address point is linked to administrative themes such as city, ward, police patrol area. In addition to retaining historical archives, threaded archives are also retained that record splits and merges of address points.

But as far as I can tell, both the dbf and shp files are missing the POSTAL_CD attributes, at least as far as a cursory analysis with gvSIG reveals. (Where I tried both opening the dbf and not seeing a column for Postal_CD, then tried opening the SHP file and my house doesn't have a postal code, so I next tried Filter, which also didn't show a postal code, and while this is un-scientific, it was enough of an analysis for me to suggest that the postal code data is in fact not included in that download. I could easily be wrong though. Oh and for those looking for what projection to use, the MTM_3Degree numbers seem to match MTM zone 10 or EPSG:2019, though as I've no formal GIS background, I could be easily incorrect. Still, I'm assuming the MTM_3Degree "rounding" to be negligible, not that I've overlaid any of my own data yet to test this out. And NTv2 correction sounds like it might be fun. I just got a kick out of seeing the nearby subdivisions all mapped out. It seemed to be missing a newer development from a year or two ago though again I could be wrong.

Louis

Philip Scott

unread,
Nov 24, 2009, 8:40:50 AM11/24/09
to dat...@googlegroups.com
Louis,
 
Based on the agreement that was recently signed with Canada Post, we do not have permission to release the postal code field attached to each address. 
 
We are going to discuss our terms of usage with Canada Post and perhaps in the near future we can include it, but for now we cannot.
 
Regards
 
Philip
 
Philip Scott
Project Management Office
I & T Division
City of Toronto
416 397-5203


>>> Louis St-Amour <ls...@yorku.ca> 11/24/2009 2:24 AM >>>

Louis St-Amour

unread,
Nov 24, 2009, 12:36:03 PM11/24/09
to dat...@googlegroups.com
Thanks for clarifying that Philip. Now that I think about it, Canada Post must not like this addressing data being this open, since it could mean people are less likely to buy their more expensive postal code products. If you could get a simple 6-digit postal code positioning file from them and overlay it with this addressing data, it would likely match up quite well. Of course, they shouldn't be /afraid/, as mailers and large companies will still want to pay for the latest up-to-date info and can, as a part of business.

Louis.

Sent from my iPhone
Message has been deleted

Marcel Fortin

unread,
Nov 24, 2009, 2:43:23 PM11/24/09
to dat...@googlegroups.com
Postal Codes are controversial in both Canada and the UK. I'd be
interested in your further thoughts on this. Crown copyright is not a
pretty beast!

Edward Ing wrote:
> A contract is not binding if it is not legal. Something makes me
> suspect that Canada Posts terms with respect to Postal Code is
> illegal.
>
> Edward
--
------------------------------
Marcel Fortin, Geographic Information Systems (GIS) and Map Librarian
Map and Data Library
University of Toronto 5027 Robarts Library
130 St. George Street, Toronto, ON M5S 1A5
tel: 416.978.1958 fax: 416-946-0522
http://www.library.utoronto.ca/maplib
Twitter: http://twitter.com/mapsgis

Richard Weait

unread,
Nov 24, 2009, 2:54:24 PM11/24/09
to dat...@googlegroups.com
For Oliver's specific request, I'd expect address points and the ward
boundaries to be both "enough" and "a better solution". We haven't
seen assurance that postal codes don't split ward boundaries.

Add the road centerlines if you want to make it a map, but I'd think a
minimum implementation would be:

Housenumber: ____
Streetname: ____
<button>Find Ward Number</button>

And let PostGIS match the street address and find the containing ward. No?

Scott Webb

unread,
Nov 25, 2009, 3:36:26 PM11/25/09
to DataTO
Hi Oliver,

Would an address search returning City Ward work for your application?

Postal code will would work, however you will encounter a number of
cases in the City where postal code areas cross ward boundaries so you
will return 2 or more wards for a givin postal code.

Using address you will always have a one-to-one
relationship....something for you to think about anyways for your
application.

Using the City's public Geocoder Web Service you can accomplish this
task. This web service is hitting a live address database as well, so
as addresses are maintained, they are updated automatically in this
'view' repository (you will always be getting up to date information).

Use the address service (WSDL URL below):
http://map.toronto.ca/geocoderv3/wsdl/com/cot/cor/geocoder/v3/ejb/AddressSession.wsdl

Here is a snippit VB.NET code to get an entered address and return the
areatype CITW, which is the short code for city wards.

----

' Initialization
Dim index As Integer
Dim addressWS As New ca.toronto.map.AddressSessionService
Dim addresses() As ca.toronto.map.Address
Dim usrAddress As String

' Get user entered address
usrAddress = TextBox1.Text

' Test OUTSIDE web service with area types
addresses = addressWS.findBySearchString(1, 3, Nothing,
usrAddress, "CITW", Nothing, Nothing, Nothing, Nothing, False,
Nothing)

' Update the list box with all matches returned from web
service
ListBox1.BeginUpdate()
For index = 0 To UBound(addresses)
ListBox1.Items.Add("INDEX: " & index)
ListBox1.Items.Add("WARD: " & addresses(index).areaName1)
ListBox1.Items.Add("ADDRESS: " & addresses
(index).lowNumber & " " & addresses(index).parsedName & " " & addresses
(index).parsedType & " " & addresses (index).formerCityName)
ListBox1.Items.Add(" ")
Next
ListBox1.EndUpdate()
----
This code worked on a form with 1 text box and 1 list box....

Full documentation for the web service can be downloaded from the
toronto.ca/open site, let me know if you have any other questions or
if this works for you...

Also, if you get this working in a production environment somewhere
I'd love to see a link where I can see this in operation!!!!!

Cheers,

Scott Webb
City of Toronto - Geospatial Competency Centre
email: sw...@toronto.ca
phone: 416-392-2999




On Nov 23, 12:37 pm, Oliver Zielke <ozie...@gmail.com> wrote:
> Hi folks,
>
> I work for non-profit IT provider Web Networks, and am looking for a
> postal code to City ward database enabling end user to find their ward
> by entering their postal code. Anybody have such information. Below is
> the response from Open Data--city says "No, Canada Post won't let us
> give that away"
>
> Begin forwarded message:
>
> From: "Open Data" <opend...@toronto.ca>
> Date: November 23, 2009 12:24:22 PM EST
> To: "Oliver Zielke" <oli...@web.net>
> Subject: Re: postal code to city ward
>
> Oliver,
>
> Based on the agreement that was recently signed with Canada Post, we
> do not have permission to release the postal code field.  Management
> is going
> to discuss our terms of usage with Canada Post and perhaps in the near
> future we can include it, but for now we cannot.
>
> Regards
>
> Philip
>
> >>> Oliver Zielke <oli...@web.net> 11/20/2009 5:23 PM >>>
>
> Hi Trish
>
> Any progress on obtaining this data? Is it available
>
> You may have seen this news
>
> http://www.guardian.co.uk/technology/2009/nov/19/ordnance-survey-maps...
>
> Thanks
>
> Oliver
>
> Oliver Zielke, Executive Directorhttp://web.net
> W: 416.596.0212 x.25 | M: 416.898.5850
>
> On Nov 4, 2009, at 2:38 PM, Open Data wrote:
>
> Hi Oliver,
>
> Thank you for your query about postal codes tied to City wards. We
> will get back to you as soon as possible.
>
> Regards,
> Trish
>
> City of Toronto |Toronto Open | Philip Scott, Open Data Project
> Manager | Trish Garner, Manager, Web Strategy > toronto.ca/open |
> opend...@toronto.ca
>
> From:   Oliver Zielke <oli...@web.net>
> To:     <opend...@toronto.ca>
> Date:   2009-11-02 10:07 am
> Subject:        postal code to city ward
>
> Hello,
>
> I work for Web Networks, a non-profit organization based in T.O.
>
> We are interested in accessing a database of postal code to city of
> toronto ward. Is that available?
>
> thanks
>
> Oliver
>
> Oliver Zielke, Executive Directorhttp://web.net

Chris T

unread,
Nov 27, 2009, 2:36:08 PM11/27/09
to DataTO
The way that I did this for FixMyStreet was to use Google's
geolocation API to get the approximate lat/lon coordinates for that
postal code, and then based on that lat/lon, do a spatial WITHIN()
query on the ward boundary polygons. That would return a fairly
accurate ward for that given postal code.

On Nov 23, 12:37 pm, Oliver Zielke <ozie...@gmail.com> wrote:
> Hi folks,
>
> I work for non-profit IT provider Web Networks, and am looking for a
> postal code to City ward database enabling end user to find their ward
> by entering their postal code. Anybody have such information. Below is
> the response from Open Data--city says "No, Canada Post won't let us
> give that away"
>
> Begin forwarded message:
>
> From: "Open Data" <opend...@toronto.ca>
> Date: November 23, 2009 12:24:22 PM EST
> To: "Oliver Zielke" <oli...@web.net>
> Subject: Re: postal code to city ward
>
> Oliver,
>
> Based on the agreement that was recently signed with Canada Post, we
> do not have permission to release the postal code field.  Management
> is going
> to discuss our terms of usage with Canada Post and perhaps in the near
> future we can include it, but for now we cannot.
>
> Regards
>
> Philip
>
> >>> Oliver Zielke <oli...@web.net> 11/20/2009 5:23 PM >>>
>
> Hi Trish
>
> Any progress on obtaining this data? Is it available
>
> You may have seen this news
>
> http://www.guardian.co.uk/technology/2009/nov/19/ordnance-survey-maps...
>
> Thanks
>
> Oliver
>
> Oliver Zielke, Executive Directorhttp://web.net
> W: 416.596.0212 x.25 | M: 416.898.5850
>
> On Nov 4, 2009, at 2:38 PM, Open Data wrote:
>
> Hi Oliver,
>
> Thank you for your query about postal codes tied to City wards. We
> will get back to you as soon as possible.
>
> Regards,
> Trish
>
> City of Toronto |Toronto Open | Philip Scott, Open Data Project
> Manager | Trish Garner, Manager, Web Strategy > toronto.ca/open |
> opend...@toronto.ca
>
> From:   Oliver Zielke <oli...@web.net>
> To:     <opend...@toronto.ca>
> Date:   2009-11-02 10:07 am
> Subject:        postal code to city ward
>
> Hello,
>
> I work for Web Networks, a non-profit organization based in T.O.
>
> We are interested in accessing a database of postal code to city of
> toronto ward. Is that available?
>
> thanks
>
> Oliver
>
> Oliver Zielke, Executive Directorhttp://web.net

Stephen van Egmond

unread,
Nov 30, 2009, 10:37:41 PM11/30/09
to dat...@googlegroups.com

On 2009-11-24, at 1:39 PM, Edward Ing wrote:

> A contract is not binding if it is not legal. Something makes me
> suspect that Canada Posts terms with respect to Postal Code is
> illegal.

Data can be licensed in Canada, even that produced by a Crown corporation. This is settled law, and hardly illegal. Appalling though it may be, this is the world we live in.

Reply all
Reply to author
Forward
0 new messages