Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get nodes matching multiple tags with specific value on Overpass QL

I'm trying to fetch POI's that matched with tourism=museum or historic=memorial from Overpass API. I tried different queries but cannot find right solution, i'm getting empty response.

Here are not working queries

area["name"="Bursa"];                                                                     
(node["tourism"="museum"](area);); 
(node["historic"="memorial"](area););
out center;
area["name"="Bursa"];                                                               
(node["tourism"="museum"]|["historic"="memorial"](area);); 
out center;

I tried theese queries on OverpassTurbo

Thanks, Ersin.

like image 361
ersinyildiz Avatar asked Sep 20 '25 12:09

ersinyildiz


1 Answers

You have to use a named set when performing multiple queries on the same area (which is also just a set). Otherwise the second query will be performed on the result of the first query.

area["name"="Bursa"]->.a;
(
  node["tourism"="museum"](area.a);
  node["historic"="memorial"](area.a);
);
out center;

Also note that you are just querying for nodes, so your query won't find any museums or memorials added as way or relation. The following query will include those, too:

area["name"="Bursa"]->.a;
(
  nwr["tourism"="museum"](area.a);
  nwr["historic"="memorial"](area.a);
);
out center;
like image 132
scai Avatar answered Sep 23 '25 13:09

scai