'Why does 'around' work but 'area' doesn't in Overpass Turbo?

I have the following overpass turbo query:

[out:json];
area[name="Zagreb"];
(
  node["tourism"~"museum|gallery"](area);
  node["amenity"~"cafe|bar"](area);
);
out center;

You can run it here: https://overpass-turbo.eu/s/1hmp

The problem is that it only returns the first node, so the tourism="museum|gallery" in this case, but not the amenity="cafe|bar".

I based my query on this answer, where both nodes get returned(!!!): Find multiple tags around coordinates with Overpass API

[out:json];
(
  node["tourism"~"museum|gallery"](around:500,53.866444, 10.684738);
  node["amenity"~"cafe|bar"](around:500,53.866444, 10.684738);
);
out center;

You can run this original one here: https://overpass-turbo.eu/s/1hml

Except that I changed the 'around' to the area of name="Zagreb". And this clearly works (although just for one of the nodes).

Does anyone have any ideas how to get both nodes (tourism="museum|gallery" and amenity="cafe|bar") to work within an area?

Thanks so much! Lovro



Solution 1:[1]

You need to store the area in a named inputset (below it's named ".myarea"), otherwise the result of the first node statement would overwrite the area in the default inputset (called ._), and would no longer be available for the second node query.

[out:json];
area[name="Zagreb"]->.myarea;
(
  node["tourism"~"museum|gallery"](area.myarea);
  node["amenity"~"cafe|bar"](area.myarea);
);
out center;

Quite a frequent issue by the way, and I'm sure there are several other post that already deal with this error.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mmd