[Talk-GB] overpass query involving pubs

Andrew Black andrewdblack at googlemail.com
Thu Oct 26 05:36:38 UTC 2017


I am confused by this.
I understood ( x; y; ); to be the union of x and y.  Rather than x passing
its results onto y. What am i missing.


On 25 Oct 2017 11:58, "Roland Olbricht" <roland.olbricht at gmx.de> wrote:

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


_______________________________________________
Talk-GB mailing list
Talk-GB at openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-gb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk-gb/attachments/20171026/40919ed8/attachment.html>


More information about the Talk-GB mailing list