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

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%


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;
permanent link

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

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×483
×4

question asked: 23 Mar '16, 18:12

question was seen: 2,246 times

last updated: 24 Mar '16, 17:49

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