0

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.

TheNiceGuy
  • 3,462
  • 8
  • 34
  • 64
  • For asking questions about Overpass API consider using http://gis.stackexchange.com or http://help.openstreetmap.org/ – scai May 07 '18 at 07:01

1 Answers1

0

Overpass API is not a geocoder.

A better approach is to first determine the location via geocoding, e.g. 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.

scai
  • 20,297
  • 4
  • 56
  • 72
  • How would using Nominatim help me in this case? If there are multiple results for the same postal code, how would I go about searching for the specific that I need? I still cannot simply pass in the country code as it might not be set in OpenStreetMap. Also from what I see, the request returns multiple results but without any details on them, so I would have to manually get the detailed results for each place that has been returned. Or am I overseeing something? Maybe you could provide an example code. Thanks – TheNiceGuy May 05 '18 at 16:36
  • Another example: `https://nominatim.openstreetmap.org/search?street=213 Brünner Straße&postalcode=1210&country=AT` This does not return the desired building. However `https://nominatim.openstreetmap.org/search?street=213 Brünner Straße&postalcode=1210` does. So the issue is still there – TheNiceGuy May 05 '18 at 16:42
  • Besides that, I would appreciate an answer to the original question due to the fact that there are different use cases for this functionality (checking if there is a result, otherwise performing another query, without another request to the api) – TheNiceGuy May 05 '18 at 17:38
  • This looks like a bug. Did you consider reporting at https://github.com/openstreetmap/Nominatim/issues ? – scai May 05 '18 at 17:54
  • I've reported this bug for you: https://github.com/openstreetmap/Nominatim/issues/1034 – scai May 07 '18 at 07:11
  • The bug has been fixed. – scai May 07 '18 at 20:17