I’m trying to create overpass request, that returns list of intersections near selected coordinate.
Task is look for closest intersections near selected point, to mark point as “near intersection between street First and street Second” if it is possible.
It must be intersections only between named/signed roads and road level must be not too small - it must be highway, street or road, not small inner service way or path.
I found (and slightly modified) this code, but it is far from ideal - it returns even points where one street cutted to two different segments (with identical street names for every segment). Construction of second part of this code is not clear for me, so I don’t understand, how to modify it to exclude points between parts of same street.
Also, I want to get coordinates and names for all ways for found intersections. Not list of other object features.
You could try the following query. As it is rather expensive to compute, please keep the bounding box small and don’t integrate this kind of query in any app which is getting called by many users!!
I fixed one minor issue: if we detect difference between ways not by name but also by ref, we must get intersections between ways with different names OR different ref. Also, I added executon limits:
Please keep in mind that this query is expensive and consumes quite some resources on the server. Unless you’re running on your own instance I’d strongly recommend to use a much lower timeout value.