[英]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.