drolbr / Overpass-API

A database engine to query the OpenStreetMap data.
http://overpass-api.de
GNU Affero General Public License v3.0
692 stars 90 forks source link

Union does not work when filtering by an area #675

Closed not-my-profile closed 1 year ago

not-my-profile commented 1 year ago

The following query works as expected, returning both the Eiffel Tower as well as the Arc de Triomphe:

[out:json];
(
    way[name="Tour Eiffel"](48.63,1.75,49.11,3.2);
    way[name="Arc de Triomphe"](48.63,1.75,49.11,3.2);
);
out center;

However when filtering using an area the union only returns the element listed first in the query, e.g.

[out:json];
area[name="Paris"];
(
    way[name="Tour Eiffel"](area);
    way[name="Arc de Triomphe"](area);
);
out center;

only returns the Eiffel Tower and when we switch the order in the query

[out:json];
area[name="Paris"];
(
    way[name="Arc de Triomphe"](area);
    way[name="Tour Eiffel"](area);
);
out center;

it only returns the Arc de Triomphe.

(Tested on https://overpass-turbo.eu/ using Overpass API 0.7.58.5 b0c4acbb)

not-my-profile commented 1 year ago

I should have read the docs more carefully. As explained there the area has to be stored in a variable, so the following works as expected:

[out:json];
area[name="Paris"]->.paris;
(
    way[name="Arc de Triomphe"](area.paris);
    way[name="Tour Eiffel"](area.paris);
);
out center;