You are not logged in.

#1 2021-02-13 19:59:05

forteller
Member
Registered: 2018-11-16
Posts: 64

Overpass – show both a route (relation) and nodes/ways?

Hi. I'm stuck at trying to create a OT query which shows both one relation (a specific bicycle route) and a lot of nodes and ways of some types.

I have one query for each, but don't understand how to combine them. I'm very thankful for all help!

The relation query is like this:

<osm-script output="json">
  <query type="relation" into="hr">
    <has-kv k="route" v="bicycle"/>
    <has-kv k="name" v="Sølvveien"/>
  </query>
  <union>
    <item set="hr"/>
    <recurse from="hr" type="relation-way" into="hrp"/>
    <recurse from="hr" type="relation-node"/>
  </union>
  <print mode="body" order="quadtile"/>
  <recurse from="hrp" type="way-node"/>
  <print mode="skeleton" order="quadtile"/>
</osm-script>

The important thing is to get the bicycle route Sølvveien. The rest of that code I have to admit I'm not sure what does. I copy pasted from somewhere.

The ways and nodes query is like this:

[out:json][timeout:25];
// gather results
(
  // query part for: “bicycle_parking=shed and access=customers”
  node["bicycle_parking"="shed"]["access"="customers"]({{bbox}});
  way["bicycle_parking"="shed"]["access"="customers"]({{bbox}});
  node["bicycle_parking"="building"]["access"="customers"]({{bbox}});
  way["bicycle_parking"="building"]["access"="customers"]({{bbox}});
  // query part for: “amenity=bicycle_repair_station”
  node["amenity"="bicycle_repair_station"]({{bbox}});
  way["amenity"="bicycle_repair_station"]({{bbox}});
  relation["amenity"="bicycle_repair_station"]({{bbox}});
  // query part for: “natural=beach”
  node["natural"="beach"]({{bbox}});
  way["natural"="beach"]({{bbox}});
  relation["natural"="beach"]({{bbox}});
  // query part for: “amenity=bbq”
  node["amenity"="bbq"]({{bbox}});
  way["amenity"="bbq"]({{bbox}});
  relation["amenity"="bbq"]({{bbox}});
  // query part for: “leisure=firepit”
  node["leisure"="firepit"]({{bbox}});
  way["leisure"="firepit"]({{bbox}});
  relation["leisure"="firepit"]({{bbox}});
  // query part for: “tourism=museum”
  node["tourism"="museum"]({{bbox}});
  way["tourism"="museum"]({{bbox}});
  relation["tourism"="museum"]({{bbox}});
  // query part for: “shop=bicycle”
  node["shop"="bicycle"]({{bbox}});
  way["shop"="bicycle"]({{bbox}});
  relation["shop"="bicycle"]({{bbox}});
  // query part for: “amenity=toilets”
  node["amenity"="toilets"]({{bbox}});
  way["amenity"="toilets"]({{bbox}});
  relation["amenity"="toilets"]({{bbox}});
  // query part for: “amenity=drinking_water”
  node["amenity"="drinking_water"]({{bbox}});
  way["amenity"="drinking_water"]({{bbox}});
  relation["amenity"="drinking_water"]({{bbox}});
  // query part for: “tourism=picnic_site”
  node["tourism"="picnic_site"]({{bbox}});
  way["tourism"="picnic_site"]({{bbox}});
  relation["tourism"="picnic_site"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

Any help on combining these? Thanks so much!

Offline

Board footer

Powered by FluxBB