[OSM-dev] Problem with XAPI and ref based search

Roland Olbricht roland.olbricht at gmx.de
Sat Nov 30 08:44:36 UTC 2013


hello everybody,

> I start by asking XAPI to give me the France admin_level 2 object like so:
> http://www.overpass-api.de/api/xapi?relation[boundary=administrative][admin_
> level=2][name=France]
> 
> this returns me the object, which contains among other things:
> <member type="relation" ref="79981" role="outer"></member>
> <member type="relation" ref="2202120" role="outer"></member>
> <member type="relation" ref="2627308" role="outer"></member>
> <member type="relation" ref="2177258" role="outer"></member>

Please try recurse down:

http://www.overpass-
api.de/api/interpreter?data=(relation[boundary=administrative][admin_level=2]
[name=France];>>;);out+meta;

The XAPI syntax is restricted to very simple use cases, and even the question 
for "all members of a certain relation" cannot be formulated. So the solution 
is to use the more comprehensive Overpass QL language.
The line

relation[boundary=administrative][admin_level=2][name=France];

searches for the relation (the same way as before) and

>>;

adds all members, members of members and so on of the last result. This gives 
the full pyramidal boundary construction. If this is too much data (these are 
more than 110 MB), you can resolve on step with

http://www.overpass-
api.de/api/interpreter?data=(relation[boundary=administrative][admin_level=2]
[name=France];rel(r););out+meta;

Here, "rel(r)" resolves only one level of relation members.

Best regards,

Roland




More information about the dev mailing list