简体   繁体   中英

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.

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.

Overpass API is not a geocoder.

A better approach is to first determine the location via geocoding, eg by using Nominatim , Photon or one of the other OSM-based geocoders . In the second step use Overpass API to find bus stops near this location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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