简体   繁体   English

如何获得所有OSM方式和标记便利设施的节点,以及使用Overpass API的方式节点?

[英]How can I get all OSM ways and nodes tagged amenity, plus way nodes using the Overpass API?

I'm trying to get all the ways and nodes with an 'amenity' key, which works okay with a union, but I also need the nodes that make up a way, and the recurse tag isn't working as expected: 我正在尝试使用“便利性”键来获取所有方式和节点,这种方式可以与并集一起工作,但是我还需要组成方式的节点,并且递归标记无法按预期工作:

<osm-script>
<union>
<query type="way">
  <has-kv k="amenity" regv="."/>
  <bbox-query s="%s" w="%s" n="%s" e="%s"/>
</query>

<query type="node">
  <has-kv k="amenity" regv="."/>
  <bbox-query s="%s" w="%s" n="%s" e="%s"/>
</query>
</union>
<recurse type="way-node" />
<print/></osm-script>

The %s are placeholders. %s是占位符。 Thanks! 谢谢!

With your code, the results of the way query are replaced by the results of the recursion. 使用您的代码,方式查询的结果将被递归的结果替换 Therefore, you should have the (usually untagged) nodes of the amenity ways in your output, but not the ways themselves. 因此,您应该在输出中包含便利途径的(通常是未标记的)节点,而不是途径本身。

Putting these in a union together, however, means that both the ways and their node end up in your output: 但是,将它们组合在一起意味着这两种方式及其节点最终都将出现在您的输出中:

<osm-script>
  <union>
    <query type="node">
      <has-kv k="amenity"/>
      <bbox-query {{bbox}}/>
    </query>
    <query type="way">
      <has-kv k="amenity"/>
      <bbox-query {{bbox}}/>
    </query>
    <recurse type="way-node" />   
  </union>
  <print/>
</osm-script>

The {{bbox}} are placeholders for multiple parameters as in your example. 如您的示例,{{bbox}}是多个参数的占位符。 If you want to test the modified query yourself, try this Overpass Turbo link . 如果您想自己测试修改后的查询,请尝试使用此Overpass Turbo链接

(Also note that you can omit the catch-all regv parameters.) (还请注意,您可以忽略所有的regv参数。)

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

相关问题 如何使用 Python 和立交桥 API 从 OpenStreetMap 下载非洲的所有医院? - How can I download all hospitals in Africa from OpenStreetMap using Python and the Overpass API? OSM API如何按城市获取所有郊区? - OSM API how to get all suburbs by city? 有没有办法从Overpass API中获得一条路? - Is there a way to get the middle of a way from Overpass API? 厨师自动化 API 以获取所有不工作节点的合规性报告 - chef automate api to get the compliance reports for all nodes not working 如何更改列表中节点的顺序 - How can i change the order of nodes in a list 如何使用Facebook graph API在事件描述中获取标记的页面? - How to get tagged pages in an event description using Facebook graph API? drupal bootstrap脚本:如何获取x类型的所有节点的列表? - drupal bootstrap script: how to get list of all nodes of type x? Umbraco 4.6+ - 如何通过C#中的doctype获取所有节点? - Umbraco 4.6+ - How to get all nodes by doctype in C#? 如何解析来自API请求的XML节点? - How do I parse XML nodes from an API request? 我每天的Drupal问题:通过api获取给定词汇表中的所有节点 - My daily Drupal question: get all nodes in a given vocabulary trough the api
 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM