[GIS] Getting list of all countries using Overpass API

djangoopenstreetmapoverpass-apipython

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?

Best Answer

The Overpass Turbo query for a list of all countries is

[out:csv("name:en")];relation["admin_level"="2"];out;

You can get it from the command line with

 overpass-api.de/api/interpreter?data=%5Bout%3Acsv%28%22name%3Aen%22%29%5D%3Brelation%5B%22admin_level%22%3D%222%22%5D%3Bout%3B%0A
Related Question