0

I would like to return a unique list of all boundaries that contain a set of specific nodes (I have that working), But I also want the results to tell me which of my listed nodes are found in which area.

This gives me all the areas that contain my nodes

[out:json];
(
node(136477260);
node(4191786934);
)
-> .a;
.a is_in;
out;

If I run one query for each node individually then I know exactly which node is in which areas, but that sounds very inefficient.
Is there a way to link the resulting areas to which of my nodes are found in inside. eg add to the output "my_nodes": 136477260, 4191786934 if the area contains both of these nodes?

thanks

1 Answers1

0

I would suggest the following approach: first gather all nodes, find the areas they're in, optionally filter them (in this case by boundary=administative and admin_level=10), then iterate over each area, and print the area followed by the node(s) inside this area:

[out:json];
node(id:136477260,4191786934)->.nodes;
.nodes is_in;
area._[boundary=administrative][admin_level=10];
foreach {
  out;
  node.nodes(area);
  out;
}
mmd
  • 3,423
  • 1
  • 16
  • 23