NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I was looking at the overpass API wiki trying to figure out how it works. I cannot seem to get it all the way. I am close! How do I get all the bicycle routes in Germany downloaded in one file? I have downloaded the germany.osm file from geofabrik but it does not seem to have all the ways and nodes that are referenced for a given relation that has the name/value pair of route/bicycle. So, I looked at overpass API to see if I can get all the bicycle routes including all their ways, nodes, and relations but cannot seem to be able to wrote that query successfully. Tried something like this but nothing is returned. Any suggestion would be greatly appreciated.

<union> <query type="relation"> <has-kv k="route" v="bicycle"/> </query> <recurse type="relation-node" into="nodes"/> <recurse type="relation-way"/> <recurse type="way-node"/> </union> <print/>

asked 31 Oct '12, 19:51

kcjailbirds's gravatar image

kcjailbirds
141131319
accept rate: 0%

Did you define a target area that is limiting the output to a certain region?

Because I think without limiting you get data for the whole planet, or am I wrong?

You can define a boundingbox with free chosen values by you or add a boundary relation that is already in the OSM data as a kind of polygon.

(01 Nov '12, 16:45) stephan75

Thank you very much!

(01 Nov '12, 20:28) kcjailbirds

Yes, a bounding box is the right approach to limit the result to Germany. Please consider

<union> <query type="relation"> <bbox-query s="47.5" n="55.0" w="6.0" e="15.0"/> <has-kv k="route" v="bicycle"/> </query> <recurse type="relation-node" into="nodes"/> <recurse type="relation-way"/> <recurse type="way-node"/> </union> <print/>

However, this is still a really huge download; please expect more than 100 MB and up to an hour waiting time. To tell this the server you need to set a larger timeout:

<osm-script timeout="3600"> <union> <query type="relation"> <bbox-query s="47.5" n="55.0" w="6.0" e="15.0"/> <has-kv k="route" v="bicycle"/> </query> <recurse type="relation-node" into="nodes"/> <recurse type="relation-way"/> <recurse type="way-node"/> </union> <print/> <osm-script>

permanent link

answered 01 Nov '12, 19:30

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

1

Thank you very much!

(01 Nov '12, 20:27) kcjailbirds

The query worked as advertised! The query gave me all the nodes and ways that were referenced by a relation and all the nodes within the ways. How can I modify this query to also give me all the relations that are referenced within a relation and all the nodes, ways, and nodes within ways for that referenced relation in addition to what it gave me? Of course I can change the box to a smaller area at a time.

(02 Nov '12, 12:56) kcjailbirds
1

Yes, please use <osm-script timeout="3600"> <union> <query type="relation"> <bbox-query s="47.5" n="55.0" w="6.0" e="15.0"/> <has-kv k="route" v="bicycle"/> </query> <recurse type="down-rel"/> </union> <print/> <osm-script>

For the sake of completeness, the query that resolves olny ways and nodes can be abbreviated as <osm-script timeout="3600"> <union> <query type="relation"> <bbox-query s="47.5" n="55.0" w="6.0" e="15.0"/> <has-kv k="route" v="bicycle"/> </query> <recurse type="down"/> </union> <print/> <osm-script>

(02 Nov '12, 13:52) Roland Olbricht

Thank you very much Roland! I am trying that now. Is there a way to instead of defining a box, define the actual boundaries around Germany? If so, How do I get the actual boundaries around germany? When I put a box around it, it pulls in relations that are actually outside Germany and in other countries like Czech Republic. I am trying to see if I can restrict it to Just Germany. Later on, I need to do it for each individual city in Germany. Thank you very much for all you help.

(02 Nov '12, 15:22) kcjailbirds

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×128

question asked: 31 Oct '12, 19:51

question was seen: 10,150 times

last updated: 02 Nov '12, 15:22

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum