简体   繁体   English

Overpass API 查找包含节点列表的所有边界

[英]Overpass API find all boundaries that contain a list of nodes

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?例如添加到输出 "my_nodes": 136477260, 4191786934 如果该区域包含这两个节点?

thanks谢谢

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:我建议采用以下方法:首先收集所有节点,找到它们所在的区域,可选择对其进行过滤(在本例中为边界 = 管理和 admin_level = 10),然后遍历每个区域,并打印该区域后跟该区域内的节点:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM