Fog Creek Software
Discussion Board




Postal code databases, with latitude/longitude?

Here's a fairly common (or at least, not uncommon) problem that some others on here have surely encountered.  I'm working on sort of a social-networking/matchmaking website where people can find other people near them, see how far away a given member is, sort search results by distance, etc.

Since most people don't happen to know their latitude/longitude coordinates offhand (*grin*), some sort of postal code/latitude/longitude database is necessary.

Ideally, the database would have the following fields:
-Country Code
-Country Name
-State/Province name
-City name
-Postal/zipcode
-Latitude
-Longitude

This information is fairly readily available for free from the US Postal Service; numerous companies online package it in a slightly more readily-usable form. 

However, finding non-U.S. postal/geodata is a TOUGH exercise.  I'd like the site to be as international-friendly as possible, but there doesn't seem to be any global postal/geodata database for sale anywhere.  Collecting it on a country-by-county basis is quite a daunting and expensive task, so I ask you all:  know of any good resources for this information?

John Rose
Monday, June 07, 2004

The US Census Bureau has a database of zip -> lat/long.

The problem is that when someone wants to do a search, you have to do the spherical math against every other zip to get your distances. And considering the size of some zip codes, this could still be pretty far off.

Outside the US it gets harder. For example, postal codes in Canada aren't public property, so you have to pay for the database, and they change on an annual basis, you need updates. That's just one country.

If you really want to do geocoding, the only sane solution is an online mapping service, and they're not cheap (five figures/year to start).

I think a better solution is to "search by area code" and allow the user to enter multiple area codes. Most people have an idea of the area codes they're willing to look in (Dice uses this for job hunting, and I found it very helpful to narrow results)

HTH,
Philo

Philo
Monday, June 07, 2004

Why don't you let people click on a big map when they sign up and calculate approximate coordinates from that?

You can also use those coordinates to pre-select language, pre-fill signup forms and do some sanity checks.

  -tim

a2800276
Monday, June 07, 2004

Thanks for the responses!

Philo:

I've actually got the U.S. Census data.  I mistakenly said USPS in my initial post, but it is in fact the U.S. Census data.  (And this is freely available on their website, for anybody who's interested)

My main problem is trying to find geodata for non-U.S. postal codes.  Getting every postal code in the world is kind of a hassle, but I'd like to at least do Canada as a start and maybe get some of Europe.  You'd *think* that governments would make this sort of thing freely available ala the US Census Bureau, but apparently not!

The area code thing is an excellent suggestion, but I don't think it quite works for what I'm trying to accomplish.  In a nutshell, while physical proximity is of high interest to members on the site, it's not the sort of thing where they'd be completely restricting their search results based on it.  And the area code thing doesn't necessarily solve the international issue.

Man, it sounds like there's some money to be made here for somebody who can cobble together an international geodata/postal code list.  :D

John Rose
Monday, June 07, 2004

Tim:

That's a cool idea, but I fear that the "user accuracy resolution" of user clicks upon on such a map would be quite low... perhaps a few hundred miles on average, at best! 

John Rose
Monday, June 07, 2004

There's a company that sells Global address data http://www.globaladdress.net/

I have an address lookup component that interfaces with their Optima server.  They sell on a per country basis and I'd guess it would be prohibitive in cost to have them all.

Simon Lucy
Monday, June 07, 2004

Send those who do not know off to http://www.terraserver.com

Just me (Sir to you)
Monday, June 07, 2004

Why would anybody want to network or socialize with a person who doesn't know the coordinates of their home out to 6 decimal places?

Portnoy
Monday, June 07, 2004

The international postal union has some details on this.

http://www.upu.int/post_code/en/universal_postcode_database.shtml

here in the UK the royal mail list their resellers.
http://www.royalmail.com/portal/rm/jump2?mediaId=400090&catId=400084
www.afd.co.uk had nice com interfaces last time I looked.

However as a cheap and cheerful solution don't forget Mappoint, they'll cover both the US & europe, just not sure if it's good enough for you.

Peter Ibbotson
Monday, June 07, 2004

check this site out

http://www.bartholomewmaps.com/

Tapiwa
Monday, June 07, 2004

I've used these with pretty good success:

http://www.zipinfo.com

They have Canadian and US info that includes TONS of info, including Lat and Long, City, State/Prov and so on.

Tim Sullivan
Monday, June 07, 2004

This conversation is being monitored under the terms of the USA PATRIOT ACT.  Please provide real names, social secuity numbers and notes from your mothers prior to 7/01/2004.  Failure to comply will result in the loss of your zip code.

Se~nor Aschcroft
Monday, June 07, 2004

http://en.wikipedia.org/wiki/Geographic_references

W
Tuesday, June 08, 2004

http://earth-info.nga.mil/gns/html/index.html

have all the worlds citites and villages with coordinates. No zip-codes though.

Jocke
Tuesday, June 08, 2004

Try MapInfo or "And International" (hard to find website address).

Both of these resell this information for US / Canada / Europe / Aus.

They are not cheap though.

Justin
Tuesday, June 08, 2004

As for "people knowing generally what zip codes are around them"  This does break down in cities.  I think there are at least a half dozen zip codes in downtown manhattan alone.

Keith Wright
Tuesday, June 08, 2004

Area codes, not zip codes.

Philo

Philo
Tuesday, June 08, 2004

downtown manhatten has a few of those too.

mb
Tuesday, June 08, 2004

We get United States, Canada and Mexico postal codes with latitude and longitude from the following company.

http://www.zipcodeworld.com

Jimmy
Saturday, June 26, 2004

*  Recent Topics

*  Fog Creek Home