NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum


I try to get all restaurants by cities in a region. In Overpass Turbo, I have : (

    {{geocodeArea:"Le Puy-en-Velay Auvergne-Rhône-Alpes France"}}->.searchArea;
    out center;

This is working fine.
But I have hundred of cities in my region (all recovered from Wikidata) and I want to get restaurants for all cities.

I don't want to do it manually in tool, so I tried to export my "query" as an url. This is the generated url: %22restaurant%22%5D%28area.searchArea%29%3B%0A%20%20way%5B%22amenity%22%3D%22restaurant %22%5D%28area.searchArea%29%3B%0A%20%20relation%5B%22amenity%22%3D %22restaurant%22%5D%28area.searchArea%29%3B%0A%29%3B%0Aout%20center%3B

As you can see in the generated url, the geocodeArea is converted to an area with ID 3600120067.

Is there a way to keep generated url with the geocodeArea as string, so I can write a script which will generate url for all cities ?
And, if not, where can I get this area ID ?


asked 01 Apr '20, 09:26

Aximem's gravatar image

accept rate: 0%

edited 01 Apr '20, 09:28


If the names are consistent in OSM, you can use a query like area[admin_level=8][name=NAME]; to access the area directly from Overpass API. Cities are usually admin level 8, but that can vary.

(01 Apr '20, 12:23) maxerickson

Thanks for your help, I will give it a try

(01 Apr '20, 12:25) Aximem

@maxerickson, this is working but I have to use exact city name. Some cities have the same name. For example there is 12 "Beaulieu" in France. That's why, with geocodeArea, I use "city + region + country". I cannot do this with area.

(01 Apr '20, 12:32) Aximem

You can do an outer area query to deal with that, and then restrict the city query to that area. And then do another one to restrict the region query to a country, and so on.

Having nominatim deal with all that is nice. For some problems, using the admin_level based area query ends up being quite a bit simpler.

(01 Apr '20, 12:53) maxerickson

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 01 Apr '20, 09:26

question was seen: 1,644 times

last updated: 01 Apr '20, 12:53

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum