This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

OverpassAPI query with two specific keys and any value

2

I am trying to retrieve a list of objects with at least two specific keys without specifying the values for those keys using the OverpassAPI.

This is the query I thought should list me all ways with at least a highway and a name tag:

http://overpass.osm.rambler.ru/cgi/interpreter?data=[out:json];way[highway][name]%2850.66%2C10.91%2C50.7%2C10.95%29%3Bout%3B

However, it just returns nothing. Specifying a highway value works as expected:

http://overpass.osm.rambler.ru/cgi/interpreter?data=[out:json];way[highway=residential][name]%2850.66%2C10.91%2C50.7%2C10.95%29%3Bout%3B

Specifying no highway value but a specific name also works as expected:

http://overpass.osm.rambler.ru/cgi/interpreter?data=[out:json];way[highway][name=%22Langewiesener%20Straße%22]%2850.66%2C10.91%2C50.7%2C10.95%29%3Bout%3B

So, why doesn't the first query work without a value for both the highway and name tag? Am I doing something wrong here or is this just not supported?

asked 15 Aug '12, 08:11

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

edited 15 Aug '12, 08:12


One Answer:

2

No, it is simply a bug. I have introduced an acceleration for that kind of queries a few days ago, and apparently haven't tested it enough. I'll check what is going wrong and then tell details.

As a temporary workaround, you can use a regular expression for one of the two conditions:

http://overpass.osm.rambler.ru/cgi/interpreter?data=[out:json];way[highway][name~%27.%27]%2850.66%2C10.91%2C50.7%2C10.95%29%3Bout%3B

Update: I just have realized that this only affects the rambler instance. Thus,

http://overpass-api.de/api/interpreter?data=[out:json];way[highway][name]%2850.66%2C10.91%2C50.7%2C10.95%29%3Bout%3B

works fine. The rambler instance runs the pre-acceleration version, and thus this might be a good occasion to update the rambler instance as well.

answered 15 Aug '12, 08:19

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

edited 15 Aug '12, 08:23

Ah I see, thanks for the quick answer :).

(15 Aug '12, 08:24) scai ♦
2

Ok, everything should be fine now. The workaround is no longer necessary.

(15 Aug '12, 11:42) Roland Olbricht

Thanks again!

(15 Aug '12, 11:57) scai ♦

Source code available on GitHub .