20

World countries and their standard codes are listed in ISO 3166-1. States (whatever are they called in different countries ("lands" in Germany, "federation subjects" in Russia etc.)) of the countries and their codes are defined in ISO 3166-2. But I couldn't find anything like this for cities.

What I need is a table listing of world cities where it would be also shown in what particular state are they situated and the state would be designated by an ISO 3166-2 code.

I have managed to find such a table listing USA cities (here) but I also need other countries data.

Ivan
  • 63,011
  • 101
  • 250
  • 382

2 Answers2

25

I was searching for information on the same issue and I've just discovered the UN LOCODE standard:

Currently, UN/LOCODE includes over 97,114 locations in 249 countries and installations in international waters. It is used by most major shipping companies, by freight forwarders and in the manufacturing industry around the world. It is also applied by national governments and in trade related activities, such as statistics where it is used by the European Union, by the UPU for certain postal services, etc

You can download for free the full LOCODE list in MS Access .mdb, .csv and .txt formats.

Hope this will help you. :)

Regards, -- Wayfarer

Wayfarer
  • 403
  • 1
  • 5
  • 10
  • issue with this file is there's no relation between regions/locations/subdivisions and cities so you get all cities but don't know to which regions they relate!! – Stephane Jan 23 '15 at 08:10
  • Yes, Steve, it does: it is on the sixth column, though I must admit that it's not complete. It is not available for all the locations and it may use a non standard code. For example, for Spain that column refers to the province without mentioning at all the upper division (autonomous communities) and also some locations have that field void. The locations that have that field filled use the ISO 3166-2:ES standard without the country code prefix. – Wayfarer Jan 28 '15 at 15:00
  • well in the doc they say subdivision is in 4th column and if take a look into this column you'll notiece several locations have their subdivisions empty. Also, if you look into the SubdivisionCodes table or file you will see there's no relation with the aformentioned subdivision codes! – Stephane Jan 29 '15 at 17:40
  • 1
    Well, it is really confusing: in the documentation they indeed say SubDivision is the 4th column, the web listing inserts a first column named Ch (Change) thus moving SubDivision column to the 5th, and the CSV file (which is the one I use) insert the Ch column plus splits the Locode column into two different columns for Country and Location code so SubDivision column becomes the 6th. It's crazy :-) – Wayfarer Feb 12 '15 at 12:45
  • 1
    Also, the web interface help says the following: _Column "Subdivision" is intended to contain the ISO 1-3 character alphabetic and/or numeric code for the administrative division of the country concerned (state, province, department, etc.), as included in International Standard ISO 3166-2/1998 and **when deemed desirable to enhance the use of the code, or when requested by the country concerned.** The country code element is not shown in this column._ It's filled only on request, that's why it's empty in most cases http://www.unece.org/fileadmin/DAM/cefact/locode/Service/LocodeColumn.htm – Wayfarer Feb 12 '15 at 12:53
  • right they said: "when requested by the country concerned" – Stephane Feb 14 '15 at 21:07
  • This could be a great resource but I cannot use since I think is not accurate: **Missing cities** e.g. Sevilla, Magdalena Colombia, it is not there, maybe it is too small???. **Missing Department** e.g. Barranquilla (ATL) **Geo location is off** e.g. Bogota 0436N 07405W https://www.google.com/maps/place/4%C2%B021'36.0%22N+74%C2%B003'00.0%22W/@4.4712679,-74.1703364,9.75z/data=!4m5!3m4!1s0x0:0x0!8m2!3d4.36!4d-74.05 – Jaider Jul 27 '17 at 01:41
6

A search on GitHub leads some dataset https://github.com/search?q=iso%203166%202

Here you find it in CSV for instance https://github.com/fran-diaz/ISO-3166

sabas
  • 743
  • 8
  • 18
  • Thank you, I found the Debian resources on one of git project much more usable then the other resource. – Rabin Feb 14 '16 at 13:41
  • Thank you. The `CSV` example is no longer available, I wondered whether might find a suitable alternative … at a glance, unfortunately not. – Graham Perrin Jan 08 '22 at 11:02