This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Best way to get the road name for a node

0

I'm interested in displaying the name of road/street that certain features sit on. One feature I'm interested in is 'crossing' another is traffic_signal. I've come up with some Overpass QL (below), but is this a sensible approach, or is there a more efficient method? The bbox I'm interested in is Norwich, UK [bbox:52.578228,1.171761,52.693864,1.525726].
Thanks, Robin

node["highway"="crossing"];
    foreach {
      way(bn)["name"]-> .ways;
      convert result
          ::id   = id(),
          ::geom = center(geom()),
          road_name    = ways.set(t["name"] ),
          road_speed = ways.set(t["maxspeed"]),
          :: = ::;
    out geom;
    }

 (node["highway"="traffic_signals"];);
    foreach {
      way(bn)["name"]-> .ways;
      convert result
          ::id   = id(),
          ::geom = center(geom()),
          road_name    = ways.set(t["name"] ),
          road_speed = ways.set(t["maxspeed"]),
          ::     = ::;
    out geom;
    }

asked 19 Jul '19, 12:22

RobinK's gravatar image

RobinK
11113
accept rate: 0%

edited 19 Jul '19, 23:46

Source code available on GitHub .