[Talk-GB] pub defined as a relation

Roland Olbricht roland.olbricht at gmx.de
Wed Oct 25 10:57:47 UTC 2017


> While i'm here, can anyone tell me why 
> http://overpass-turbo.eu/s/szG does not return nodes and 
> ways-and-their-nodes? It is very similar to the example

Thank you for asking. As I will explain below, this is an opportunity to 
improve the documentation.

> area[name="Brighton and Hove"][admin_level=6];
> (
>    node(area)[amenity=pub];
>    way(area)[amenity=pub];
> );
> (._;>;);
> out body;

In line 3 we have only nodes as a result. In line 4, we ask for ways 
that are inside the areas from the previous result (the one from line 
3). Thus, line 4 can never have a result.

Hence, please change it to

area[name="Brighton and Hove"][admin_level=6]->.a;
(
    node(area.a)[amenity=pub];
    way(area.a)[amenity=pub];
);
(._;>;);
out body;

This way, we store the result of line 1 in a set named "a". And in lines 
3 and 4 we now ask for nodes resp. ways that are in areas from "a". "a" 
could be an arbitrary name (composed of letters, digits, and 
underscores, starting with a letter; names are case sesitive).

By the way, I suggest to replace lines 5 and 6:

area[name="Brighton and Hove"][admin_level=6]->.a;
(
    node(area.a)[amenity=pub];
    way(area.a)[amenity=pub];
);
out center;

This makes both nodes and ways into a point with a single location. For 
the purpose of viewing the objects in Overpass Turbo, this means you 
need to transfer and process fewer data.

I thought there were an explanation at
http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example
but it isn't. I will add the example and the explanation there.

For the question whether it was different before: No. I am a strong 
proponent of backwards compatibility. It will rarely or never happen 
that I change existing language semantics.

- Roland



More information about the Talk-GB mailing list