Many online forms have demands for long lists of options, most commonly states, provinces, and countries. Validating the data entered into those forms can also mean checking against reams of information: determining if an areacode is valid, for instance.
Entering any of this data by hand is a recipe for repetitive stress injury or insanity. Instead, I’d suggest these resources:
- StateTable
- Collated by Dave Ross: offers lists of US states, Canadian provinces and minor possessions in CSV, SQL, HTML and PHP formats.
- OpenGeoCode
- Offers all of the official countries of the world as an HTML
<select>
form code chunk, in English, French and Spanish. Lots of other information sources too. - Geonames
- A free geographical database with over 8,000,000 placenames, including zipcodes, largest cities and highest mountains.
Zippopotam.us
- A Free JSON-based API that pulls postal and zip codes for over 50 countries.
- Geocoder.ca
- Maps locations to physical coordinates (for example, given a longitude and latitude, Geocoder can provide the zip code). Currently (and rather stupidly) being sued by Canada Post over the legal
ownership
of postal codes.
Finally, Saša Stamenković has a list of all countries in all languages and data formats. Seperately, Kasabi was an effort to create open datasets; while the site was recently shuttered, many of the datasets are archived on S3 and the Internet Archive.
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.