ABOUT GEO-TOPO DATA AND POSTAL CODES
The Z Directory is a combination of code & data. The data included in the installer allows your application to immedately use real-world info:
- continents - a tiny table, for the continents on planet #3.
- countries - an up-to-date list of all the countries.
- country owners - an associative array, countries "owned by" other countries (eg, Puerto Rico belongs to America; Hong Kong is part of China).
- government region - this data comes from geonames.org, which refers to it as "admin codes". It is a list of first- and second-order administrative regions within a country. For America, this would be states (first-order) and counties (second-order).
- airports - a large list of all the airports in the world. This data is primarily the airport code, name, and country it is in.
- schools - a list of universities (this data is currently only a tiny sample - WIP).
- phone codes - not area codes, but codes for a telephone number's "type": fax, home number, work number, pager, etc.
- area code - telephone area codes for USA.
- post code - postal ("zip") codes for many countries (see below).
- time zones - information about the time zones we use on Earth, including DST and GMT offsets.
- landmark codes - this is a list of codes for all sorts of things found on Earth, such as a school, a river, a reef, a military base, or cave. It could be as large as a continent or as small as a bus stop.
- subjects - this is an experimental, hierarchal list of "subjects" dealing with the computer domain.
- certification codes - Bachelor of Science, MBA, Doctorate, etc.
- languages - a list of the languages used by humans. This is based on geonames and is ISO-conformant.
- first names - a large list of first names, from Aaron to Zenichi. This is used by the Z Directory "person" object.
Postal codes are available for only a subset of the world's countries. To the right is the current list of countries included in the Z Directory postal codes (along with their 2-letter ISO 3166 codes). Besides the post code, other data associated with a given value include latitude and longitude, name associated with the code, and any governmental administrative names and codes (for the USA, this would be the state and county names). Usually a postal code's primary name is in English (or English-language equivalent). However, the governmental administration names are usually in the area's local language; that is, the text encoding for the field would be that used for the language (ie, "en-US", for USA zip codes).
In order to include postal codes with your Z Directory setup, select the country desired by right-clicking on the country, then save the file ("Save Link As.."). Each file is named post_code.unl. The names are the same because the database loader program (topo_load.exe) searches for the file whose name matches the database table name. The downloaded file should be put into the topology/ subdirectory where the Z Directory is installed (sibling to $ZDIR_LIBHOME and $ZDIR_INCLUDES). On Microsoft systems by default this path would be:
loading postal codes
There is a catch if you want to load the postal codes during the installation process - the target directory does not exist prior to the install, but it must be put into place before the loader program looks for the file (during the install process). The database load is a rather long process, so you may have a window of time to do this, or you can run topo_load after the install process.
The load process for postal codes is time-consuming. The load files for the full world dataset requires about 80 MB, and the loading process on a slow processor can take overnight. Hence, this particular item is not included with the default distribution.
loading multiple files
You can include multiple countries. Unfortunately, until a more automatic system is provided, the process is rather arcane. You can simply concatenate post_code.unl files. However, you need to understand how the files are organized. Postal code load files are grouped by the first letter of the country code. If you want the codes for Macedonia (MK) or Mexico (MX), you will also get postal codes for Malaysia (MY), Martinique (MQ), Moldova (MD), and any other M-countries. If you want the codes for Germany (DE), its download file also contains those of Denmark (DK), Algeria (DZ), and the Dominican Republic (DO). If you download multiple files (see below), take care that the first letter of the country code is unique, lest you end up globbing together duplicate files.
loading only a single country
If you want the codes only a specific country, you will need to manually edit the downloaded file (using a regular text editor). If for example you are interested in only post codes for Iceland (IS), this is a relatively small block of lines (1 line per pcst code) wedged between the massive data blocks of India (IN) and Italy (IT). Since in the provided set of postal codes there is only one country whose country code starts with 'U', people downloading the zip codes for America get exactly that. In this case, America is the only country in this file (you can verify this by scanning the codes column at the right). Other examples of "1 country, 1 file" include Japan, Mayotte (which, even though it has its own country code, is really considered a "department" of France), Reunion, and South Africa.
Russian postal codes will soon become available. Vettrasoft has the data, there are some issues loading the data, hopefully it will be made available soon.
There are several schemes currently being explored to simplify installing postal codes into the Z Directory dataset. The current system for installing postal codes came about October 2012, and is something of a patch done in order to be able to make things work in the existing framework without heavy source code modifications. Improvements may be slow in coming: addressing this problem has somewhat lower priority over other issues (2012).