This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Extracting node from highways

0

I am using overpas turbo to extract nodes from highways(=motorway). Below is the code that I am using. However, this code gives me all the nodes in the bounding box and does not filter the highways.

[out:xml];
(
(way(39.90,32.83,39.96,32.89);)->.a;
((way.a["highway"="motorway"]);)->.b;
((way.a["highway"="motorway_link"]);)->.b;
);
(.b;>;);
out body qt;

asked 17 Mar '15, 05:04

Manish%20Bansal's gravatar image

Manish Bansal
16335
accept rate: 0%

edited 17 Mar '15, 05:12


One Answer:

2

You must specify the input set of the recuse down operator as well: .b >;, otherwise it will recuse down the current default input set, which here is set by the outermost union parentheses.

Also: when you set the same output data set twice to the same variable (here: ->.b), the former will be overridden by the latter. If you want to merge the results, you'd have to use an union: (…)->.b;. You can also combine a bbox and a tag query into one statement to get the query more concise: way(<bbox>)[<tag>];. In the end the query you are looking for could look like this: http://overpass-turbo.eu/s/8e0

answered 17 Mar '15, 07:01

tyr_asd's gravatar image

tyr_asd
1.2k51927
accept rate: 64%

Thank you very much for your help.

(17 Mar '15, 07:44) Manish Bansal

Source code available on GitHub .