UN/LOCODE - The complete database for MySQL
Mercredi 30 juillet 2008Here is the full UN/LOCODE code list. The UN_LOCODE table contains 242 countries, with major cities.
Table Structure :
iso3166_a2 | locode | name_wo_diac | name_loc | subdiv | func | status | date | iata | latitude | longitude |
---|---|---|---|---|---|---|---|---|---|---|
ISO 3166 Alpha 2 country ID | locode | name without diacritics | name in locale language | subdivision | Function | Status | Date | IATA code | Latitude | Longitude |
Example | ||||||||||
FR | ABP | Amelie-les-Bains-Palalda | Amélie-les-Bains-Palalda | 66 | - -3- - - - - | RL | 0212 | NULL | -42,28 | 2,4 |
The locode column is empty for a country.
Metrics
- 242 countries
- 58 599 locations
- 31 736 locations have latitude and longitude
How to use it
All the countries : select * from un_locode where locode = '' order by name_loc
(The country name start with a period. This is like that in the official file)
All the town in a country : select * from un_locode where iso3166_a2 = 'FR' and locode <> ‘’ order by name_loc
All town with an airport : select * from un_locode where iso3166_a2 = 'FR' and locode <> ‘’ and func like ‘%4%’ order by name_loc
More information
Download
The package contains a MySQL dump and a PHP script to recreate the dump (usefull for update) => un_locode.zip (1,2Mb)