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

Overpass API Union doesn’t work

1
1

Hi,

I use the overpass api for QA a lot. But somehow I can't get the union statement working. I tried it as described in the Wiki but I only receive the data from the first statement.

area[name="Sankt Andreasberg"];
(
  node[amenity=recycling](area);
  node[amenity=bench](area);
) -> .a;
.a out;

asked 23 Mar '16, 18:12

Ogmios's gravatar image

Ogmios
766202639
accept rate: 25%


One Answer:

5

The node[amenity=recycling](area); statement overwrites the default input set so there are no areas for the second node query.

You just need to save the area to a set and pass it to the node queries (untested):

area[name="Sankt Andreasberg"]->.searchArea;
(
  node[amenity=recycling](area.searchArea);
  node[amenity=bench](area.searchArea);
) -> .a;
.a out;

answered 23 Mar '16, 19:05

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

edited 23 Mar '16, 19:09

Thanks. Knowing that could have spared me a lot of trying and searching.

(23 Mar '16, 19:09) Ogmios

As this is a really common issue, can somebody here please update the wiki page accordingly to make this a bit clearer? Thanks!

(24 Mar '16, 17:47) mmd