Need world zip codes

D

Dylan Parry

Harlan said:
It amazes me that one should have to pay for this information.

You'll probably find (especially in the UK, don't know about elsewhere)
that what you are paying goes towards the wages of the many staff
required to maintain such a database, including the surveyor who has to
go out and geocode each new post/zip code.

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
 
C

CJM

Harlan Messinger said:
It amazes me that one should have to pay for this information. The entire
US five-digit ZIP code list, supplied as a CSV file, assuming a maximum of
33 bytes per code for the code itself, the city, and the state, would be
less than 3.3MB. This would hardly tax the USPS web site.

The cost of distribution is insignificant compared to the cost of collection
and maintenance....
 
G

Geoff Berrow

You'll probably find (especially in the UK, don't know about elsewhere)
that what you are paying goes towards the wages of the many staff
required to maintain such a database, including the surveyor who has to
go out and geocode each new post/zip code.


Oh if only that were true. I imagine, like road tax, that it just goes
to the treasury.
 
D

Dylan Parry

Geoff said:
Oh if only that were true. I imagine, like road tax, that it just goes
to the treasury.

Yes, but the difference here is that you would be buying the data from
either Royal Mail or the Ordnance Survey - both of which operate like
private companies (even if they do get public funding). So any money
they charge you is unlikely to leave that company for the treasury.

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
 
T

Toby Inkster

Dylan said:
Republic of Ireland springs to mind. AIUI, they have postcodes for
Dublin, but that's about it.

They're introducing them over the next couple of years.
 
D

Dylan Parry

Toby said:
They're introducing them over the next couple of years.

Interesting. I remember an Irish friend of mine giving me her address
some time back; I didn't realise they had no postcodes then, but she
said there was no need for postcodes because "the posty knows who I am" :)

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
 
T

Toby Inkster

Charles said:
Bloody good thread. Every reply on-topic and informative!

Replying to Charles post, as I couldn't find a more appropriate one to
reply to...

For what it's worth, I've written a PHP library that validates and
canonically formats (people in the UK will know how important that is!)
postcodes for the following countries:

- Argentina
- Australia
- Belgium
- Bermuda
- Canada
- China
- Cyprus
- Czech Rep
- Denmark
- France
- Germany
- Greece
- India
- Ireland
- Israel
- Italy
- Japan
- Luxembourg
- Malaysia
- Netherlands
- New Zealand
- Norway
- Portugal
- Singapore
- South Africa
- Spain
- Sweden
- Switzerland
- United Kingdom
- United States of America

In addition, it's capable of the following additional functions for
certain countries:

- can handle optional country-codes for those countries that
use them (e.g. Belgian postcode '1234' is often written
'B-1234'; French '12345' written 'F-12345'; etc)

- can break down postcode into parts (UK: area, district,
sector, unit; USA: ZIP, ZIP+4; Netherlands: '1234' versus
'1234 AB'; Canada: District, FSA, LDU)

- can look up town and county from postcode (UK only)

- can look up longitude and latitude of postcode (UK only,
resolution is postcode district)

- can find distance between two postcodes (UK only, resolution
is postcode district)

- can find list of postcode districts within X metres of a
particular postcode (UK only, resolution is postcode district)

- provides an AJAX function to neatly format a postcode text
input on an HTML form. (UK only)

- accepts certain odd postcodes for the UK, though doesn't
provide geo data for them.

GIR 0AA (Giro)
SAN TA1 (Santa)
ASCN 1ZZ (Ascension Is)
BBND 1ZZ (British Indian Ocean Territory)
BIQQ 1ZZ (British Antarctic Territory)
FIQQ 1ZZ (Falkland Is)
PCRN 1ZZ (Pitcairn Is)
SIQQ 1ZZ (South Georgia & South Sandwich Is)
STHL 1ZZ (St Helena)
TDCU 1ZZ (Tristan da Cunha)
TKCA 1ZZ (Turks and Caicos Islands)
BFPO xxxx (British Military)

Some of the data used by the library I have under licence, so I can't
redistribute it all, but the library and some of the data can be found
here:

http://examples.tobyinkster.co.uk/postcodes/

I hope people find this useful. If you have any ideas for improvement
(preferably in patch form!) then please let me know.
 
H

Harlan Messinger

Dylan said:
You'll probably find (especially in the UK, don't know about elsewhere)
that what you are paying goes towards the wages of the many staff
required to maintain such a database, including the surveyor who has to
go out and geocode each new post/zip code.

The amount of effort involved in converting the database that the Post
Office maintains *anyway* for its own use into a CSV file and copying it
to the same location, plus the incremental cost for designing the page
that says, "Click here for the list," and storing and transmitting the
modest file, is far, far less than the revenue brought in by charging
every single person who wants the data $30.
 
H

Harlan Messinger

CJM said:
The cost of distribution is insignificant compared to the cost of collection
and maintenance....

It doesn't need to be "collected". It's *their* data. They always have
it, whether they distribute it or not.
 
T

Toby Inkster

Harlan said:
The amount of effort involved in converting the database that the Post
Office maintains *anyway* for its own use

AIUI, at least in the UK, Royal Mail doesn't make any use of geocoding
data at all, so there's no "its own use" -- the geocoding is entirely
done for profit.
 
D

Dylan Parry

Toby said:
AIUI, at least in the UK, Royal Mail doesn't make any use of geocoding
data at all, so there's no "its own use" -- the geocoding is entirely
done for profit.

Exactly. All of which keeps the cost of postage at a particularly low
price. 30-something pence to send a letter is much lower than the actual
handling cost, which involves manual sorting (in the case of
hand-written envelopes), transport and hand-delivery by the postman. How
far would you be able to personally deliver a letter for 30p? I'm not
sure you could even *step* onto a bus at that price <g>

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
 
D

Dylan Parry

Harlan said:
It doesn't need to be "collected".

Of course it does! Who do you think geocodes new properties? Do you
think they just randomly assign xy coordinates to each new postal code?
Someone has to go out (usually in the pissing rain) and survey the
coordinates for each property.

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
 
G

GreyWyvern

And lo, Toby Inkster didst speak in alt.html,alt.php,alt.www.webmaster:
For what it's worth, I've written a PHP library that validates and
canonically formats (people in the UK will know how important that is!)
postcodes for the following countries:

- Canada

Can it handle H0H 0H0 ?

Grey
 
T

Toby Inkster

GreyWyvern said:
And lo, Toby Inkster didst speak in alt.html,alt.php,alt.www.webmaster:


Can it handle H0H 0H0 ?

Yes -- the parsing for non-UK postcodes is far more rudimentry than for UK
postcodes. For Canada it just uses the following regular expression on a
normalised (all uppercase, with whitespace collapsed) postcode to check
the format is OK:

/^[A-CEGHJ-NPRSTV-Z][0-9][A-CEGHJ-NPRSTV-Z]\s+[0-9][A-CEGHJ-NPRSTV-Z][0-9]$/

Regular expressions for non-UK countries are here:
http://examples.tobyinkster.co.uk/postcodes/data/intlpc.txt

Columns are:

- ISO 2-character country code, lower case
- PCRE for valid postcodes
- optional country prefix for certain European countries
(the PCRE should match the country-prefixed postcode)
 
C

CJM

All very cool... but seriously, you need to get out more...

What possessed you in the first place?
 
J

Jonathan N. Little

CJM said:
All very cool...
What?

but seriously, you need to get out more...

Who?

What possessed you in the first place?

To do what?

Learn to quote, please. I'll have to hunt back through the thread to
find out what the hell you are referring to.
 
R

Richard Rundle

Dylan Parry said:
Of course it does! Who do you think geocodes new properties? Do you
think they just randomly assign xy coordinates to each new postal code?
Someone has to go out (usually in the pissing rain) and survey the
coordinates for each property.

Normally they don't. The basics of the address come from the local
authority, both as Local Planning Authority, and as the Street Naming &
Numbering Authority. This data is supplied (at the moment) free of charge to
RM and the OS. The Council also plot the dwellings and pass the map overlays
to the OS. The RM then adds the postcode, and adds the property to PAF. The
OS then uses that info to build ADDRESS-POINT, which is then SOLD back to
the local authority as part of the Mapping Services Agreement, and we are
charged for each time a query is performed on any database that may, some
time in the past, been matched against ADDRESS-POINT, on an internet
transaction.
 
H

Harlan Messinger

Dylan said:
Of course it does! Who do you think geocodes new properties?

They have to do that *anyway* to use the codes *themselves*. They don't
have to do it all over again just to post the list so the rest of us
have access to it.
 
T

Toby Inkster

Harlan said:
They have to do that *anyway* to use the codes *themselves*. They don't
have to do it all over again just to post the list so the rest of us
have access to it.

The post office doesn't need to know longitude/latitude information to use
postcodes -- it only needs to know where a postcode is in terms of region,
town and street. When the postman is delivering the mail, he doesn't do so
with a GPS device in his hand, saying, "0.5 degrees due North East".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,779
Messages
2,569,606
Members
45,239
Latest member
Alex Young

Latest Threads

Top