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

# Find all the streets within n meters from a railway

 1 Hi to all, I'm an OSM newbie. I'm looking for an Overpass QL query to retrieve, given a railway in a bounding box, all the roads that are within X meters (for example 50 m) from that. I've tried to search but I was not able to find a solution for this problem. Can someone help me to extract this info? Thanks! 4liX asked 19 Nov '13, 10:18 4lix 16●1●1●3 accept rate: 0% stephan75 12.6k●5●56●210

 1 I am not sure you will find any answers to your problem/question in Overpass QL, at least not in "around". The referred documentation explicitly states "...get all nodes in the closer environment of one or more given nodes..." where the "closer environment" is a circular area defined by a given radius. Therefore many exceptions in generalisation as you have mentioned in you railway - streets example. You are actually aiming at a special geo-spatial search - find objects (fully or partly) inside a corridor. Corridor is a special area where all points of the border polygon are at the same distance from a leading/skeleton line (note the difference between points and nodes). This geo-search model is essential in many GIS applications (like Location Based Services, Data Preparation, Collision Detection, Safety Monitoring, Digital Radar and so on). One can even assume a corridor network where the leading lines are creating a complex graph. There are principally two solution-models to the mentioned geo-search: Polygon Algebra and Image Algebra based. In the first model the corridor area is decomposed into circular and rectangular primitive areas around the skeleton nodes and edges. The relations of the input object to these primitive criteria areas decide the answer - inside, partly overlapping or outside. The solution may use early filtering, it is relatively simple but it may become slow in complex cases. In the second model, both the input object(s) and the criterion area are presented as highly compressed high resolution bi-tonal images. Multiplication of the two images provides the answer both visually and analytically. The second solution model is much more robust with, practically, no limits when it comes to collision detection, safety monitoring, digital radar and so on. Finally, note that even if all nodes of an input object are strictly inside (outside) an arbitrary polygonal area it does not necessarily mean that the whole input object is inside (outside) the area. answered 25 Nov '13, 12:34 sanser 695●38●39●55 accept rate: 5%
 3 In the OSM wiki there is a documentation of the parameter "around" ... have you tried this? Please tell us success or failure, including your query string. answered 19 Nov '13, 16:21 stephan75 12.6k●5●56●210 accept rate: 6% 3 An example: http://overpass-turbo.eu/s/1yA (20 Nov '13, 06:52) Roland Olbricht Thanks a lot guys! :-) I tried before posting with around command but clearly I made some mistakes. The query string is (here the link): ``````[timeout:86400]; rel(45.5115,12.1220,45.5320,12.1608)["ref"~"^RFI"]; way(r); (way[highway~"^(primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|unclassified|residential)\$"](around:50); >; ); out; `````` But I noticed that not all ways in the range are included (a example of way excluded). Is there a way to include also these cases? Indeed I'm interested in excluding all the roads that cross the railroad (maybe with difference statement) and find the towns/city to which the result set of ways belongs. Is that possibile? The last question (I promise :-) ): given a street far within 50 meters from a railway found with the overpass ql query before, there is a way to calculate the minimum distance from the rail? Thanks! (24 Nov '13, 17:42) 4lix Concerning the missing example: Please add "|service" to the highway list. Other variants may be missing, depending on what you want to do with the roads (finding brigdes, finding ways allowed for cars/bicycles/pedestrians or whatever). (27 Nov '13, 08:54) Roland Olbricht 1 A difference statement could use "(around:0)": see http://overpass-turbo.eu/s/1Cu I have also added "service" in this case and repeated the bounding box to speed up the whole query (For full exactness, the bounding box must be slightly expanded, but I neglected that). (27 Nov '13, 09:00) Roland Olbricht 1 For the last question: See http://overpass-turbo.eu/s/1Cv This executes for each way an area query such that in the output the areas this way belongs to are listed. (27 Nov '13, 09:02) Roland Olbricht

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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
×147
×68
×63
×33

question asked: 19 Nov '13, 10:18

question was seen: 5,982 times

last updated: 27 Nov '13, 09:02

### Related questions

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