News for hackers. Stuff that matters.

Ask HN: What to use for world zip codes?

I'm developing a website and need postal codes for as many countries as possible. All I need is City, State, and zip/postal code. I found zipcodeworld.com but, they're products are a lot more than I need. Wondering if anyone knows of a low cost solution?
( 16 comments | 21 points | on HN )
Re:Ask HN: What to use for world zip codes? by rmc on Tuesday May 18, 2010 @07:25AM (#1357134)
Address formats are different all over the world. Lots of places call them "postcodes" not zip codes (e.g. the UK). Some places have no postcodes (e.g. Ireland). Lots of places don't have 'states'. And the US has lots of 'cities' whereas lots of places would have local towns or counties.

You usually need addresses to send someone something. I'd suggest just putting in a text field and letting the user just type it in freeform.

Re:Ask HN: What to use for world zip codes? by Davertron on Tuesday May 18, 2010 @04:17PM (#1358888)
I'd say freeform is a pretty good way to go if you don't need automated systems looking at the data. We've had issues with having specific fields for all the reasons mentioned in the comments (certain places don't have states/zips, etc.). However, we offer estimated shipping, so we have to be able to easily parse the address to send data to shipping carriers' web services (UPS, DHL), and that would be a total nightmare with freeform text. I would say making a nice interface that changes depending on the selected country would be ideal (google checkout seems to handle this pretty well).
Re:Ask HN: What to use for world zip codes? by pierrefar on Tuesday May 18, 2010 @08:15AM (#1357218)
And you can check that the address is sane using a geocoder. Both Google Maps and Yahoo! Maps have freely-accessible APIs for that.
Re:Ask HN: What to use for world zip codes? by cianestro on Tuesday May 18, 2010 @08:04PM (#1359577)
I asked the same question several weeks ago. Google's reverse geocoding api is a great solution. Instead of inserting hundreds of thousands of records into a database and juggling different tedious validation techniques it's a much better idea to only use latitudes and longitudes for locating people geographically. However, the project's details may require other routes but still thought I would share:

http://code.google.com/apis/maps/documentation/examples/geoc...

Users just click on their location on the map and Google hands off the nearest address info.

Re:Ask HN: What to use for world zip codes? by sad on Thursday May 20, 2010 @02:32PM (#1364826)
This has been a pet peeve of mine for a very long time.

Creating a free-form address parser might be a fun project. Validating the addresses might get expensive though. Are there any low cost/free alternatives to a service like Experian's QAS?

Re:Ask HN: What to use for world zip codes? by nfnaaron on Tuesday May 18, 2010 @09:31AM (#1357393)
Upvoted for the "sensible" solution of freeform, but I'd like to hear from folks who need each piece broken out, and why.

I imagine zip codes are useful for auto-filling/formatting city information.

Shipping account software?

Re:Ask HN: What to use for world zip codes? by leftnode on Tuesday May 18, 2010 @06:36AM (#1357076)
Also, keep in mind, don't make the Zip Code required. Some countries (Ireland being the most prominent) don't have them.
Re:Ask HN: What to use for world zip codes? by henrikschroder on Tuesday May 18, 2010 @07:51AM (#1357173)
Also, don't make state required, most countries don't have them.
Re:Ask HN: What to use for world zip codes? by moe on Tuesday May 18, 2010 @08:49AM (#1357288)
Generally don't make too many assumptions about the address format if you're dealing with international customers.

Many of the address forms on US-sites are a bit challenging to europeans because even after selecting "Other" in the State-dropdown we're still left with a bunch of input fields that don't quite fit our local address format.

Most people (including myself) are probably used to that by now and just duplicate stuff as needed (City/State) and leave others blank. But I wonder what the bounce rate amongst less savvy users is for these forms.

Re:Ask HN: What to use for world zip codes? by po on Tuesday May 18, 2010 @05:54AM (#1357036)
What language are you using? I don't know of a datasource for it but I'm familiar with the Django project's localflavor contrib app:

http://docs.djangoproject.com/en/dev/ref/contrib/localflavor...

You can also try searching through programmable web:

http://www.programmableweb.com/apis/directory

Re:Ask HN: What to use for world zip codes? by yarone on Tuesday May 18, 2010 @05:57PM (#1359269)
The best resource that I know of is addressdoctor.com.

See their demo here: http://www.addressdoctor.com/lookup/default.aspx?lang=en

Via a web service, they enable you to produce the right address form fields on a country-by-country basis. I've met with their CEO in person and kicked the tires and would highly recommend them.

Re:Ask HN: What to use for world zip codes? by niklas on Tuesday May 18, 2010 @06:22AM (#1357064)
Re:Ask HN: What to use for world zip codes? by sigil on Tuesday May 18, 2010 @03:21PM (#1358669)
Geonames is great. It doesn't get any freer than this (in both senses of the word).
Re:Ask HN: What to use for world zip codes? by lsc on Tuesday May 18, 2010 @05:38AM (#1357015)
I use what came with freeside, my billing system. http://www.freeside.biz/freeside/ but it's not complete, so a better solution, if someone has one, would be great.
Re:Ask HN: What to use for world zip codes? by paulgerhardt on Tuesday May 18, 2010 @07:14AM (#1357122)
Re:Ask HN: What to use for world zip codes? by henrikschroder on Tuesday May 18, 2010 @07:54AM (#1357179)
What do you need the postal codes for? How are you going to use them?