简体   繁体   English

OpenstreetMap Overpass API-验证标签(如果存在)

[英]OpenstreetMap Overpass API - Validate tag if present

I have this query 我有这个查询

[out:json];

(
 way['addr:street'='Kurzenmoor']['addr:housenumber'='12']['addr:postcode'='25370']['addr:country'='DE'];
 node(around:700)['highway'='bus_stop'][!'ref'];
);

out;

This does not return a result due to the fact that the country has not been specified at the API. 由于未在API中指定国家/地区,因此不会返回结果。

This works: 这有效:

[out:json];

(
 way['addr:street'='Kurzenmoor']['addr:housenumber'='12']['addr:postcode'='25370'];
 node(around:700)['highway'='bus_stop'][!'ref'];
);


out;

Is there a way to combine these? 有没有办法将这些结合起来? If there is no country present, I want the result, if there is a country present it should match the desired one (in this example "DE", if it matches, I want the result, otherwise I do not want it. 如果没有国家/地区,则需要结果;如果有国家/地区,则应该匹配所需的国家(在此示例中为“ DE”,如果匹配,则我需要结果,否则,我不需要结果。)

Overpass API is not a geocoder. 天桥API不是地理编码器。

A better approach is to first determine the location via geocoding, eg by using Nominatim , Photon or one of the other OSM-based geocoders . 更好的方法是首先通过地理编码(例如,使用Nominatim ,Photon或其他基于OSM的地理编码器)确定位置。 In the second step use Overpass API to find bus stops near this location. 第二步,使用Overpass API在此位置附近找到公交车站。

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

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