To get the union of both "highway=cycleway" and "cycleway", you can use a (nested) "union". Please note that we need a separate variable name "all_ways" in this case to use the found ways twice:
<area-query ref="3600438171"/>
<recurse type="node-way" into="all_ways"/>
<union>
<union>
<query type="way">
<item set="all_ways"/>
<has-kv k="highway" v="cycleway"/>
</query>
<query type="way">
<item set="all_ways"/>
<has-kv k="cycleway"/>
</query>
</union>
<recurse type="way-node"/>
</union>
<print mode="meta"/>
To get the parent relation of the way, please add a further recurse statement. This adds the parent relations only.
<area-query ref="3600438171"/>
<recurse type="node-way" into="all_ways"/>
<union>
<union into="selected_ways">
<query type="way">
<item set="all_ways"/>
<has-kv k="highway" v="cycleway"/>
</query>
<query type="way">
<item set="all_ways"/>
<has-kv k="cycleway"/>
</query>
</union>
<recurse from="selected_ways" type="way-relation"/>
<recurse from="selected_ways" type="way-node"/>
</union>
<print mode="meta"/>
If you want further the child elements of this parent relation, please add yet another recurse. But this can return very much data if you have hit a road network, a national border or another large relation:
<area-query ref="3600438171"/>
<recurse type="node-way" into="all_ways"/>
<union>
<union into="selected_ways">
<query type="way">
<item set="all_ways"/>
<has-kv k="highway" v="cycleway"/>
</query>
<query type="way">
<item set="all_ways"/>
<has-kv k="cycleway"/>
</query>
</union>
<recurse from="selected_ways" type="way-relation"/>
<recurse type="down"/>
<recurse from="selected_ways" type="way-node"/>
</union>
<print mode="meta"/>
answered 18 Dec '12, 09:29

Roland Olbricht
6.7k●3●64●89
accept rate: 36%
Thanx for you!