1

Given a list of node ids returned by an OSRM map matching query I am trying to find a list of corresponding way ids:

{"nodes":[384845483,3831831361,2628299968,502266756,346268605,373873712,1302513709,9444444740,2431858827,10287564212,271979126,10721097610,10287564276,10721097609,10721097608,7328319500,7328319511,10287564277,271979123,9441944872,271979114,4560271019,373878694,4560271018,373878690,9442435560,373878688,9053978499,9442435552,9442435679,373878684,1085916739,373880925,9442435755,1085916895,373880928,1085916901,373880931,5753185380,373880934,4244175765,2431858826,433073515,373880937]},"distance":927.4}

However in the Overpass API manual I can not even find a similar query, that would use any ids.

Is it even possible to search by a node id with the Overpass API or is it only meant to use tags and bounding boxes?

1 Answer 1

1

That's actually fairly easy to do:

node(id:384845483,3831831361,2628299968,502266756,346268605,373873712,1302513709,9444444740,2431858827,10287564212,271979126,10721097610,10287564276,10721097609,10721097608,7328319500,7328319511,10287564277,271979123,9441944872,271979114,4560271019,373878694,4560271018,373878690,9442435560,373878688,9053978499,9442435552,9442435679,373878684,1085916739,373880925,9442435755,1085916895,373880928,1085916901,373880931,5753185380,373880934,4244175765,2431858826,433073515,373880937);
way(bn);
out geom;

Query: https://overpass-turbo.eu/s/1tPl

You would need to do a bit of post processing on your end to see where each of the nodes ended up. This shouldn't be a big issue, though.

2
  • Thank you, your query is working perfectly and I was expecting having to do the post-processing to match the way nodes... But what is meant by way(bn) in the query? Is bn some special key word? Commented Apr 15, 2023 at 18:39
  • 1
    way(bn) gives you the parent ways for nodes in the inputset, and it's documented here: wiki.openstreetmap.org/wiki/Overpass_API/…
    – mmd
    Commented Apr 15, 2023 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.