[OSM-dev] Syntax of XAPI queries with OR and NOT?
Stefan Keller
sfkeller at gmail.com
Sun Apr 15 21:08:41 BST 2012
Hi,
2012/4/15 Paul Hartmann <phaaurlt at googlemail.com> wrote:
> 2012/4/15 Stefan Keller <sfkeller at gmail.com>:
>> Hi,
>>
>> With a XAPI API I'd like to make following query types (operators/predicates):
>> 1) OR query: Example "[amenity=restaurant] OR [tourism=office]"
>> 2. NOT query: Example "NOT [cuisine=pizza]"
>>
>> What could be a suitable syntax for doing this?
>> My suggestions:
>> 1a) ?xapi=node[amenity=restaurant]|[tourism=office]
>> or 1b) ?xapi=node[amenity=restaurant]|node[tourism=office]
>> 2) ?xapi=-node[cuisine=pizza]
>>
>> Or did I miss something in
>> http://wiki.openstreetmap.org/wiki/XAPI#Tag_Predicates ?
>>
>> Yours, Stefan
>
> Not sure, what you are up to, but you could use Overpass API, e.g.
>
> 1)
> (node["name"="Lichtscheid"];node["name"="Müngstener Straße"]);out;
>
> full URL: <http://overpass-api.de/api/interpreter?data=way%5B%22highway%22%21%3D%22residential%22%5D%2850%2E7%2C7%2E1%2C50%2E701%2C7%2E101%29%3Bout%3B>
>
> 2)
> way["highway"!="residential"](50.7,7.1,50.701,7.101);out; [2]
>
> full URL: <http://overpass-api.de/api/interpreter?data=way%5B%22highway%22%21%3D%22residential%22%5D%2850%2E7%2C7%2E1%2C50%2E701%2C7%2E101%29%3Bout%3B>
Thanks for the tip. I'm really after a clean extension of the XAPI syntax.
The examples from Overpass API you show me seem to be little bit weird:
> 1)
> (node["name"="Lichtscheid"];node["name"="Müngstener Straße"]);out;
Why parantheses? That's not needed here (and in XAPI neither).
Why semicolon between tags? Is this the operator for OR?
> 2)
> way["highway"!="residential"](50.7,7.1,50.701,7.101);out; [2]
Why "out" and why a semicolon before that? That's not URL like.
Why "(50.7,7.1,50.701,7.101)"? There is a
"[bbox=left,bottom,right,top]" parameter in XAPI for that.
But what inspires me is the simple idea of != for NOT.
Yours, S.
More information about the dev
mailing list