zip codes

Nigel Rantor wiggly at wiggly.org
Mon Aug 17 11:42:40 EDT 2009


MRAB wrote:
> Sjoerd Mullender wrote:
>> Martin P. Hellwig wrote:
>>> Shailen wrote:
>>>> 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 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.
>>
> 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



More information about the Python-list mailing list