I am using Overpass Turbo, with extended syntax to query places in an area, usually a country, using the following syntax

out body;

Now, I would like to use this query against the open API directly.

I did figure out that it is possible but that the API is limited in regard to the extended syntax (the curly braces, it seems). So when I export the query from overpass turbo to text (Export -> Query -> Text), I get the following output:

out body; 

I can then POST this request to the API and it works.

Now my question:

I see that the text export converted the area code "CH" to the string/id 3600051701.

Is it possible to have a lookup for these IDs? I might need to query many different countries and it would be convenient to have a lookup table somewhere.

I am new to OSM/Overpass.

1 Answer 1


When searching for country areas instead of using {{geocodeArea:CH}} I found that this also works: area["ISO3166-1"="CH"]

To retrieve a list of IDs of country areas you can query


which will return something like the following, with all relevant tags attached:

  <area id="3600051477"/>
  <area id="3600051701"/>
  <area id="3600060189"/>
  <area id="3600062781"/>
  <area id="3602202162"/>
  <area id="3602323309"/>

A way to get all country area IDs is to query for boundary=administrative & admin_level=2 (see the OpenStreetMap Wiki) in combination with the existence of the ISO3166-1 tag:

out ids;

This results in 214 areas at this point. Leaving out the ISO3166-1 tag results in a 391 results where there are a lot of duplicates and unwanted data. Some entries appeared to be Dutch islands, for example, which exist in addition to the main country Netherlands.

  • Thanks for the answer - this looks very interesting. I'll try it out tomorrow and will be back with feedback :) Commented Jan 27, 2016 at 18:30
  • 1
    So, I finally found time to test it, and it's working out very well. Especially what you are stating in the first sentence is saving me a lot troubles (and work :) ). Thanks for the answer @chrki, accepted! Commented Jan 31, 2016 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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