This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

show restaurants inside cities or towns

0

Hey guys, I am trying to find all restaurants inside a city or town like this on overpass turbo:

[out:json][timeout:25];
area["ISO3166-1"="AM"];
area(area)['name:en'~"^Ararat"]["place"="town"]->.a;
node(area.a)["amenity"="restaurant"];
out qt;

but its result is empty, if I am using the relation :

[out:json][timeout:25];
area["ISO3166-1"="AM"]->.b;
rel(area.b)['name:en'~"^Ararat"];
out geom;
{{style: 
  area
  { color:gray; fill-color:DarkGray; }
}}
map_to_area;
node(area)["amenity"="restaurant"];
out qt;

there is 1 restaurant inside Ararat town alt text

What is the difference between the 2 queries? and how can I show restaurants inside cities or towns? not inside province or state!

asked 22 Mar '23, 08:59

alt2020's gravatar image

alt2020
11335
accept rate: 0%

1

Which specific area/province do you wish to search? Your search criteria is ambiguous ('name:en'~"^Ararat") The restaurant you highlight isn't in a town try [place~"town|village|city"]

(22 Mar '23, 15:19) DaveF

do I need to search first a province first? and after that, I have to search the town and then In town, I have to search restaurant.Ararat is a town in Ararat province, @DaveF

(22 Mar '23, 18:51) alt2020

I chenged query ti this [out:json][timeout:25]; area["ISO3166-1"="AM"]; area(area)[place~"town|village|city"]->.a; area(area.a)['name:en'~"^Ararat"]->.b; node(area.b)["amenity"="restaurant"]; out qt; but my query result is all restaurants inside Ararat province, I just want all restaurant inside Ararat town. https://overpass-turbo.eu/s/1sLq @DaveF

(22 Mar '23, 18:56) alt2020

I think it depends how the town is defined. If there's a town boundary, then things will be much easier compared to a node. Unless all the restaurants' address have place:city(or town) = ararat specified.

(24 Mar '23, 03:49) kucai
1

You will need to include ways and relations as object types too.

(01 Apr '23, 17:37) SimonPoole ♦

Source code available on GitHub .