Where can I get postal codes for all countries?
My guess is that your lost friend is GeoNames.
My guess is that your lost friend is GeoNames.
A numeric ZIP code is — in a small way — misleading. Numbers should mean something numeric. ZIP codes don’t add or subtract or participate in any numeric operations. 12309 – 12345 does not compute the distance from downtown Schenectady to my neighborhood. Granted, for ZIP codes, no one is confused. However, for other number-like … Read more
The answer probably depends how critical it is for you to receive support and possible customization for this service. Google can certainly do this. Look into their XML and Geocoding API’s. You should be able to craft an XML message asking Google to return Map coordinates for a given address. If the address is not … Read more
Skimming through Wikipedia’s Postal Codes page, 32 characters should be more than enough. I would say even 16 characters is good.
For more international use, one schema to consider is the one used by Drupal Address Field. It’s based on the xNAL standard, and seems to cover most international cases. A bit of digging into that module will reveal some nice pearls for interpreting and validating addresses internationally. It also has a nice set of administrative … Read more
It is possible to represent addresses from lots of different countries in a standard set of fields. The basic idea of a named access route (thoroughfare) which the named or numbered buildings are located on is fairly standard, except in China sometimes. Other near universal concepts include: naming the settlement (city/town/village), which can be generically … Read more
I’d recommend taking a look at the UK Government Data Standard for postcodes [link now dead; archive of XML, see Wikipedia for discussion]. There is a brief description about the data and the attached xml schema provides a regular expression. It may not be exactly what you want but would be a good starting point. … Read more
The unicode CLDR contains the postal code regex for each country. (158 regex’s in total!) Download core.zip from http://unicode.org/Public/cldr/26.0.1/ unzip core.zip Take a look at common/supplemental/postalCodeData.xml from the unzipped content (direct content: common/supplemental/postalCodeData.xml) Google also has a web service with per-country address formatting information, including postal codes, here – http://i18napis.appspot.com/address (I found that link via … Read more