I'm a developer that's trying to build a django application and trying to incorporate the Overpass API to it. I'm new to the API and OpenStreetMap (and GIS in general), so I thought I would start off by getting a list of all of the countries and build from that.

However I've searched online and nowhere does it mention how to do this with the API, can someone show what query does this?

  • 2
    If you incorporate this in your app, don't forget to send a meaningful User Agent along with your HTTP request (not just the default one as set by your framework) and - as the list of countries does not change every 2 minutes - preferably use some local caching! According to the usage policy, there's a max of 10'000 requests per day.
    – mmd
    Feb 3, 2017 at 8:26
  • I'm not sure what you mean by user agent. Feb 3, 2017 at 8:50
  • 3
    See en.wikipedia.org/wiki/User_Agent
    – mmd
    Feb 3, 2017 at 8:59

2 Answers 2


The Overpass Turbo query for a list of all countries is


You can get it from the command line with

  • 1
    The results of this query look a bit strange, as it includes empty lines and things like "Austria — Czech Republic". I'd recommend to include the ISO3166-1 tags as well: [out:csv("name:en")]; relation["admin_level"="2"]["ISO3166-1"~"^..$"];out;
    – mmd
    Feb 4, 2017 at 12:36

The Overpass Turbo query for a list of all countries is


See http://overpass-turbo.eu/s/uiX for results.

Note added boundary=administrative compared to accepted result - it removes some unwanted results like high-level religious boundaries ( https://www.openstreetmap.org/relation/7826647 is an example)

type!=multilinestring removes boundary sections (see https://wiki.openstreetmap.org/wiki/France_boundary_pyramidal_construction why not adding it lists countries such as "France - Italy")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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