Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to download a list of all countries on this planet from OSM. Also, for selected countries, I would like to have states and cities.

How can this easily be achieved? There must be an easier way that to download the whole planet and iterate through all nodes, ways and relation, checking for each whether it maches my criteria, I hope...

share|improve this question
For major world cities – Mapperz Mar 29 '14 at 22:32
Thanks, but that's not quite what I want. I don't need a few specific individual cities. Rather, I'd like to have the whole world, but not in detail. For a specific city, I just want to know that it exists, what its name is, where on earth it is, and in which country. I don't need neighborhoods, streets POIs etc. – Michael Junk Apr 2 '14 at 13:42
up vote 4 down vote accepted

Overpass API allows you to download only selected objects. For country borders, admin_level=2 should return the information you want:

  <query type="relation">
    <has-kv k="admin_level" v="2"/>
  <print mode="meta"/>

This returns 302 border relations without all coordinates.

States and cities have higher admin levels according to the local administrative hierarchy.

Alternatively, you can query for nodes with place=country:

  <query type="node">
    <has-kv k="place" v="country"/>
  <print mode="meta"/>

This returns 226 countries represented by a single point in the middle, including the coordinates.

share|improve this answer
Thanks! That seems to be a good resource. Unfortunately consistentenly times out. Any ideas? – Michael Junk Apr 2 '14 at 13:54
Try to load the relation without the border coordinates. Most countries have a lable point with place=country as you can see in my extended answer. – AndreJ Apr 2 '14 at 15:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.