如何在一个位置搜索多个标签?

Wil*_*ley 4 overpass-api

我正在试图弄清楚在给定的GPS位置周围找到某些类型的所有节点的最佳解决方案.

假设我希望将所有咖啡馆,酒吧,餐馆和公园都围绕给定点X.xx,Y.yy.

[out:json];(node[amenity][leisure](around:500,52.2740711,10.5222147););out;
Run Code Online (Sandbox Code Playgroud)

这没有任何回报,因为我认为它搜索既不可能的舒适和休闲节点.

[out:json];(node[amenity or leisure](around:500,52.2740711,10.5222147););out;
[out:json];(node[amenity,leisure](around:500,52.2740711,10.5222147););out;
[out:json];(node[amenity;leisure](around:500,52.2740711,10.5222147););out;
[out:json];(node[amenity|leisure](around:500,52.2740711,10.5222147););out;
[out:json];(node[amenity]|[leisure](around:500,52.2740711,10.5222147););out;
[out:json];(node[amenity],[leisure](around:500,52.2740711,10.5222147););out;
[out:json];(node[amenity];[leisure](around:500,52.2740711,10.5222147););out;
Run Code Online (Sandbox Code Playgroud)

这些解决方案导致错误(400:错误请求)

我找到的唯一可行解决方案是以下一个导致查询非常长的解决方案

[out:json];(node[amenity=cafe](around:500,52.2740711,10.5222147);node[leisure=park](around:500,52.2740711,10.5222147);node[amenity=pub](around:500,52.2740711,10.5222147);node[amenity=restaurant](around:500,52.2740711,10.5222147););out;
Run Code Online (Sandbox Code Playgroud)

没有多个"周围"声明,是否有更简单的解决方案?

编辑:发现这个有点短.但仍有多个"周围"的陈述.

[out:json];(node["leisure"~"park"](around:400,52.2784715,10.5249662);node["ameni??ty"~"cafe|pub|restaurant"](around:400,52.2784715,10.5249662););out;
Run Code Online (Sandbox Code Playgroud)

mmd*_*mmd 7

您可能正在寻找的是对键的正则表达式支持(不仅仅是值).

以下是基于上述查询的示例:

[out:json];
node[~"^(amenity|leisure)$"~"."](around:500,52.2740711,10.5222147);
out;
Run Code Online (Sandbox Code Playgroud)

注意:自0.7.54版(2017年第一季度发布)以来,Overpass API还支持带有"或"条件的过滤条件.请参阅此示例,了解如何使用此新(if: )过滤器.

  • 此功能现已上市,详情请查看http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Key.2Fvalue_matches_regular_expression_.28.7E.22key_regex.22.7E.22value_regex.22.29. (2认同)