[OSM-talk] query nodes by attributes of connected ways?

Roland Olbricht olbricht at mentz.net
Fri Jun 4 06:38:56 UTC 2021


Hello,

> I'm am trying to extract a set of nodes that represent signalized intersections with bike infrastructure leading into them.
>
> the trouble I have run into is that I don't think there is a way to query nodes according to the attributes of the ways that connect to them.

    area[name="Great Britain"]->.a;
    way[highway=cycleway](area.a);
    node(w)[highway=traffic_signals];
    out;

gives you all nodes in Great Britain that have the tag
highway=traffic_signals and are part of a way with tag
highway=cycleway. The query is somewhat slow, thus I suggest to
experiment with a bounding box:

    way[highway=cycleway]({{bbox}});
    node(w)[highway=traffic_signals];
    out;

There are suspiciously few results. You can relax the way condition
with an union:

    ( way[highway=cycleway]({{bbox}});
      way[bicycle~"^(permissive|designated|yes)$"]({{bbox}}); );
    node(w)[highway=traffic_signals];
    out;

and/or the node condition with an union:

    ( way[highway=cycleway]({{bbox}});
      way[bicycle~"^(permissive|designated|yes)$"]({{bbox}}); )->.w;
    ( node(w.w)[highway=traffic_signals];
      node(w.w)[crossing]; );
    out;

Best regards,

Roland

NB: This is not an opinion of my employer, but my personal account is
today inaccessible due to a faulty laptop.



More information about the talk mailing list