gpt4 book ai didi

overpass-api - 如何搜索一个位置周围的多个标签?

转载 作者:行者123 更新时间:2023-12-01 18:59:41 27 4
gpt4 key购买 nike

我正在尝试找出查找给定 GPS 位置周围某些类型的所有节点的最佳解决方案。

假设我想要获取给定点 X.xx,Y.yy 周围的所有咖啡馆、酒吧、餐厅和公园。

[out:json];(node[amenity][leisure](around:500,52.2740711,10.5222147););out;

这不会返回任何内容,因为我认为它会搜索既舒适又休闲的节点,这是不可能的。

[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;

这些解决方案会导致错误(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;

没有多个“around”语句是否有更简单的解决方案?

编辑:发现这个有点短。但仍然有多个“周围”语句。

[out:json];(node["leisure"~"park"](around:400,52.2784715,10.5249662);node["ameni‌​ty"~"cafe|pub|restaurant"](around:400,52.2784715,10.5249662););out;

最佳答案

您可能正在寻找的是 regular expression support for keys (不仅仅是值(value)观)。

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

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

注意:自 0.7.54 版本(2017 年第一季度发布)起,Overpass API 还支持带有“或”条件的过滤条件。请参阅this example了解如何使用这个新的(if: )过滤器。

关于overpass-api - 如何搜索一个位置周围的多个标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24931580/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com