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

Find node/way at a specific distance range from given node/way

0

I'm using Overpass query to identify the nodes with a specific tag that are located only within a certain distance range from node with another specific tag. This sounds similar to this question related to proxmity search and this other distance calculation between nodes question.

But to tell the difference, I can try to explain with an example.

Find a cafe within a distance range of 450 m and 550 m from a library or

Find a gas station with a distance range of 9 km and 11 km from IKEA or

Find the railway crossing that is between a distance 900 m and 1100 m from a train station.

Query for 2nd search:

[timeout:300]; way[name=IKEA]({{bbox}}) -> .i; ((node[amenity=fuel](around.i:1100); way[amenity=fuel](around.i:1100););); out geom;

[timeout:300]; way[name=IKEA]({{bbox}}) -> .i; ((node[amenity=fuel](around.i:1100); way[amenity=fuel](around.i:1100););-((node[amenity=fuel](around.i:900); way[amenity=fuel](around.i:900);););); out geom;

I have used .around to specify the range limits and used out geom 1 to limit my result with only 1 output. For these 3 queries, the distance provided to .around clause will be considered as a direct distance and not the routing distance for a car or a train. How can I make sure that the train travels 0.9 to 1.1 km from station to the rail-crossing.

I wish to know if it is at all possible to achieve such query in Overpass. It would be great if there is confirmation for the same or suggestion to make this work through other method.

Thanks!

asked 26 Oct '18, 09:13

user1894's gravatar image

user1894
11446
accept rate: 0%

Source code available on GitHub .