zip codes

S

Shailen

Is there any Python module that helps with US and foreign zip-code
lookups? I'm thinking of something that provides basic mappings of zip
to cities, city to zips, etc. Since this kind of information is so
often used for basic user-registration, I'm assuming functionality of
this sort must be available for Python. Any suggestions will be much
appreciated.

- Shailen Tuli
 
A

Aahz

Is there any Python module that helps with US and foreign zip-code
lookups? I'm thinking of something that provides basic mappings of zip
to cities, city to zips, etc. Since this kind of information is so
often used for basic user-registration, I'm assuming functionality of
this sort must be available for Python. Any suggestions will be much
appreciated.

There's no module; you have to purchase the information and then massage
it yourself.
 
S

Shailen

Thanks Martin and Aahz. Anyone know if zip code information is
copyrighted for the US? Anyone can look up zip codes on usps.gov (and
other locations),so the information is readily available. I need zip
codes for a handful of cities and could map those myself (or write a
script to scrape them for me), but am not sure if they *MUST* be
purchased for copyright reasons. Anyone know?

- Shailen Tuli
 
P

Paul Rubin

Shailen said:
Thanks Martin and Aahz. Anyone know if zip code information is
copyrighted for the US? Anyone can look up zip codes on usps.gov (and
other locations),so the information is readily available. I need zip
codes for a handful of cities and could map those myself (or write a
script to scrape them for me), but am not sure if they *MUST* be
purchased for copyright reasons. Anyone know?

I don't think US zip code info is copyrighted. There is a lot of it
in the TIGER database:

http://www.census.gov/geo/www/tiger/tigerua/ua_tgr2k.html

There are also some API's operated by usps.com if you want just a few
lookups now and then.

It was a long time ago, I don't remember specifics, and the contents
are surely out of date by now, but I extracted a bunch of the TIGER
geographic coordinates for zip codes here:

http://www.nightsong.com/phr/chess/zipcodes.zip
 
S

Sjoerd Mullender

Martin said:
There might be an associated can of worms here, for example in the
Netherlands zip codes are actually copyrighted and require a license if
you want to do something with them, on the other hand you get a nice SQL
formatted db to use it. I don't know how this works in other countries
but I imagine that it is likely to be generally the same.

Also in The Netherlands, ZIP codes are much more fine-grained than in
some other countries: ZIP code plus house number together are sufficient
to uniquely identify an address. I.e. you don't need the street name.
E.g., my work address has ZIP code 1098 XG and house number 123, so
together they indicate that I work at Science Park 123, Amsterdam.

In other words, a simple city <-> ZIP mapping is not sufficient.

--
Sjoerd Mullender


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iQCVAwUBSokU3T7g04AjvIQpAQJ9IwP9H41MMUt1GBbQk1nDVGKLSVidbONMD9+I
uhUpMs/1s7FlEE2rk7ty7qpmE66Q8iI0BWYGtM/PXQmbP5bSrmjKpAupU1gSQKuj
U7cYpiGyoFhaxjgB5lewAiGZCsZhWmAw/rycEvBktVTyXWkvkb52x1e6jOkmuXPx
tmosMzIBtG0=
=pIXy
-----END PGP SIGNATURE-----
 
M

MRAB

Sjoerd said:
Also in The Netherlands, ZIP codes are much more fine-grained than in
some other countries: ZIP code plus house number together are sufficient
to uniquely identify an address. I.e. you don't need the street name.
E.g., my work address has ZIP code 1098 XG and house number 123, so
together they indicate that I work at Science Park 123, Amsterdam.

In other words, a simple city <-> ZIP mapping is not sufficient.
The same comment applies to UK postcodes, which are also alphanumeric.
My home postcode, for example, is shared with only 3 other houses, IIRC.
 
S

steven.oldner

The same comment applies to UK postcodes, which are also alphanumeric.
My home postcode, for example, is shared with only 3 other houses, IIRC.- Hide quoted text -

- Show quoted text -

Google for Zip codes. There are some free databases of codes, but
they are dated. USPS and 3 party vendors sell zip code databases and
lists. The USPS APIs are a joke. They were going to charge me for
using them.

I ended up using a 2 year old database of ZIP codes for my needs.

Hope this helps!
 
N

Nigel Rantor

MRAB said:
The same comment applies to UK postcodes, which are also alphanumeric.
My home postcode, for example, is shared with only 3 other houses, IIRC.

Kind of off-topic...but nevertheless...

Yes, the UK postcode database (PAF) can be bought from the Royal Mail
for a fee.

The data cannot be copyright, but the version they maintain and
distribute is.

As an aside, the PAF has finer grained information than simply the
postal code, every letterbox in the UK has (or is meant to) a DPS
(delivery point suffix), so that given a post code and DPS you can
uniquely identify individual letterbox even when, for example, a house
has been split into multiple flats.

So, nastily, you *can* identify individual letterboxes, but the Royal
Mail does not publicise the fact, so you cannot actually look at a post
code on a letter and determine the letterbox it is intended for.

Shame really.

n
 
P

Piet van Oostrum

GE> You can't copyright "information" as such. Only concrete
GE> expressions of information. A particular publication
GE> containing zip code information can be copyrighted. The
GE> underlying facts themselve cannot be.

But that doesn't help you if you need that information and the only way
to obtain it is from copyrighted sources.
 

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,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top