Ian Dees | 15 Apr 2012 22:34
Picon
Gravatar

Re: [OSM-dev] Syntax of XAPI queries with OR and NOT?

On Sun, Apr 15, 2012 at 3:26 PM, Stefan Keller <sfkeller <at> gmail.com> wrote:
Hi,

2012/4/15 Philipp Borgers <borgers <at> mi.fu-berlin.de>:
> Hi,
>
> issue two queries? One for [amenity=restaurant] and one for
> [toursim=office] ?
>
> I think the pipe "|" is intended for keys and values. You can do
> something like this [amenity|tourism=restaurant|office]. This returns
> entities for amenity=restaurant, amenitry=office, tourism=restaurant and
> tourism=office
>
> I think the NOT operator is only supported for "Child Element
> Predicates".

Right. That's what I understand too.

Following the ideas from Overpass API I currently would suggest the
following syntax extensions for XAPI:

1) OR or union operator ("pipe") as it's denoted in XAPI wiki page,
now valid for tags (nothing between tags means implicit AND as up to
now in XAPI).
?xapi=node[amenity=restaurant]|node[tourism=office]

2) NOT only with values
?xapi=node[cuisine!=pizza]

The "out" parameter from Overpass seems to indicate the response/output format.
If that is really needed (like for an alternate OSM JSON) I would
propose to introduce the parameter "format"
&format=xml . That's ugly and not RESTful too [1] - but that's XAPI style :->

jxapi will respond with JSON if you use .json as a file extension for the request. e.g. map.json?bbox=... or *[foo=bar].json

Unfortunately the OSMF jxapi is down at the moment and MapQuest's isn't recent-enough to support this feature. 
_______________________________________________
dev mailing list
dev <at> openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev

Gmane