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

OverpassQL: How can i filter for ways and their related nodes in a given radius?

0

I am struggling with my query setup. What i want is a set of nodes and ways (and their related nodes) in a given radius.

This is what i have so far:

(
nw(around:1000,52.46989,13.21026)[highway~"^(motorway|trunk|primary|secondary|tertiary|unclassified|residential|living_street|service)$"];
nw(around:1000,52.46989,13.21026)[highway~"^(footway|path|track)$"];
nw(around:1000,52.46989,13.21026)[natural~"^(cave_entrance|spring|peak|rock)$"];
nw(around:1000,52.46989,13.21026)[tourism~"^(wildernis_hut|viewpoint)$"];
);
(._;>;);
out body;

This returns all the related of nodes of the found ways in that radius. But i don't want nodes that are not in the given radius, even if they are related to said ways. How can i achieve this?

Also i am sure there is a more efficient way to use the around-filter (only applying it ones) but i couldn't figure this out either.

asked 09 May '22, 12:42

Tibooo's gravatar image

Tibooo
11113
accept rate: 0%

IIRC the string of punctuation on the line above out body gives all child nodes for the dataset under consideration. I imagine you would need to re-filter for distance after this stage, but that might give poor results as a straight section of road passing through the area could have no nodes in the search radius even if it goes directly over the point you're querying.

(11 May '22, 08:43) InsertUser

thank you for the reply @InsertUser, i think this is it. i tried to replace the line with another around filter but if i just add another around filter instead it works! (although it seems very hacky)

(12 May '22, 13:42) Tibooo

@Tibooo Could you post your solution for others to learn from.

(07 Jun '22, 17:12) DaveF