6

I got relation data using Overpy, and I got a list of member node IDs and member ways IDs. As members of a relation, they don't have all their attributes. So as another step I want to query Overpy by the list of IDs to get those nodes/ways with all their attributes.

Using the wizard in Overpass turbo I tried:

[out:json][timeout:25];
(
  node["id"="1926700039"]({{bbox}});
);
out body;
>;
out skel qt;

But it returns nothing.

How do I query nodes and ways by lists of IDs?

3
  • 1
    You know that you can fetch all relation members based on a relation id in a single query, right? Example: (rel(8015932);>;);out meta;
    – mmd
    Commented Jun 8, 2022 at 19:32
  • Nope. I had no idea that was possible. That's a great suggestion! Can you recommend a source where I can learn the details of how to use these queries? The documentation itself is too sparse with no examples. Commented Jun 10, 2022 at 9:05
  • Sorry, that question is way too broad for a comment, there are numerous sources out there. Did you try some web search?
    – mmd
    Commented Jun 18, 2022 at 11:11

1 Answer 1

6

I didn't get any answers or hints, nor could I find any examples of doing this (except in Overpass API, which has a slightly different syntax), but by trial and error I discovered the answer (which is actually very similar to the method for Overpass API).

For one node, this worked:

[out:json][timeout:25];
(
  node(1926700039)({{bbox}});
);
out body;
>;
out skel qt;

and for multiple nodes:

[out:json][timeout:25];
(
  node(id:1926700039, 6224865808, 6186983783)({{bbox}});
);
out body;
>;

It works the same for ways as well.

1
  • 4
    You don't really need a bbox here, node(id:1926700039, 6224865808, 6186983783); out body; would be sufficient.
    – mmd
    Commented Jun 18, 2022 at 11:09

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.