Helo, I Have this query
but for less queries to overpass server i want to join more categories to one query, I think this should be like this
but i have error there. can you please show me true syntax for getting both categories? asked 25 Jan '18, 14:12 davittorosyan aseerel4c26 ♦ |
An alternative to the regex solution given in the other answers is to use the union operator, which is specified by grouping queries inside of parentheses:
This will likely be clearer if the query involves several different keys. The output of the union can also be saved in a named set:
answered 25 Jan '18, 19:35 maxerickson Thank you for answer, but when i trying to get bars and restaurants with this query area["name"="London"]; ( node(area)["amenity"="bar"]; node(area)["amenity"="restaurant"]; )->.all; ( .all; - .; ); (.;>;); out; i see in results ONLY bars.... where is my mistake?
(26 Jan '18, 07:16)
davittorosyan
You need to name the area and then reference the name, see https://help.openstreetmap.org/answer_link/48795/
(08 Nov '18, 12:56)
reubot
|
The correct syntax is
This is an example query more info on the syntax can be found in the Overpass documentation on One or the other name. answered 25 Jan '18, 17:01 escada |
You should write this:
instead of:
If you want to add more, like fast_food, pub, cafe, etc, you can do it easily:
You have infinite other possibilities using regular expressions in overpass... answered 25 Jan '18, 17:01 edvac Thank you for anwser, this is works well, but in case if i should get one form amenity and another from shop? ["amenity"="bar" || "shop"="supermarket"] ... ?
(26 Jan '18, 07:18)
davittorosyan
In that case, you better separate the queries and then union them: area["name"="London"]; node(area)["amenity"~"bar|restaurant"]->.amenities; node(area)["shop"~"supermarket|clothes"]->.shops; ( .amenities; .shops; )->.all; ( .all; - ._;); (._;); out;
(26 Jan '18, 10:55)
edvac
1
I would also change "London" by "Greater London" to avoid getting some nodes in North America, that you probably don't want: http://overpass-turbo.eu/s/voH Or you could use the relation code instead: http://overpass-turbo.eu/s/voG
(26 Jan '18, 11:01)
edvac
1
@edvac thanks a lot for your quick and good answer, this is great solution for me, thanks again. I have one another question but don't want add to this topic. If you can, please see this question also https://help.openstreetmap.org/questions/61819/how-get-all-ways-without-nd-tags
(26 Jan '18, 14:30)
davittorosyan
1
You are welcome ;) I gave you an answer to that new query. Hope it is what you want...
(26 Jan '18, 15:09)
edvac
|