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 |
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> answered 01 Nov '12, 19:30 Roland Olbricht 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
|
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.
Thank you very much!