I want to run following Overpass QL query in order to get way IDs of all buildings inside a polyon:
way(poly:"50.7 7.1 50.7 7.2 50.75 7.15")[building];
>;
out ids;
Since I'm using the osm-common library, I need to convert this script to Overpass XML. I did it using the convert form here.
The result:
<osm-script>
<query into="_" type="way">
<polygon-query bounds="50.7 7.1 50.7 7.2 50.75 7.15" into="_"/>
<has-kv k="building" modv="" v=""/>
</query>
<recurse from="_" into="_" type="down"/>
<print from="_" limit="" mode="ids_only" order="id"/>
</osm-script>
But when I run it, I get node IDs, not way IDs.
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2013-11-06T07:51:02Z"/>
<node id="252553109"/>
<node id="252553111"/>
<node id="252553112"/>
<node id="252553114"/>
<node id="252553115"/>
<node id="252553117"/>
<node id="255302992"/>
<node id="255302993"/>
<node id="255302995"/>
<node id="255763355"/>
<node id="255763356"/>
<node id="255763357"/>
<node id="255763358"/>
<node id="255763430"/>
<node id="255763431"/>
<node id="255763432"/>
...
<node id="2519505892"/>
<node id="2519505893"/>
<node id="2519505894"/>
<node id="2519505895"/>
<node id="2519505896"/>
</osm>
How should I modify the Overpass XML query in order to get way IDs of the buildings?
Best Answer
When I manually enter a Query for ways Overpass turbo suggests an auto repair so as to also get nodes for the way. This then amounts to
see http://overpass-turbo.eu/s/1q1 .
Change
out body
toout ids
if you really only want way IDs, but without the information which node belongs to which way.