I have a lat/lng pair, and I need to find the nearest street and intersection.

For example: street X, corner with Y.

I have Nominatim and Overpass running.

My approach is:

  • Get all ways near the lat/lng with Overpass
  • Calculate distance between all nodes and my lat/lng
  • Find the two closest to my lat/lng and that belong to different streets
  • Those should be X, and then Y

Is there any better approach? I feel like I'm wasting CPU and underutilizing Overpass.

Also, I know that X and Y may not intersect at all. This only means they are close, nothing else.

Any help is welcome.

  • You should look at Postgis instead, Overpass won't give you the "nearest X"
    – mmd
    Oct 15, 2020 at 9:25
  • Thanks MMD, will try that. I'm looking at github.com/kartoza/docker-osm to get a running PostGIS server. Do you happen to have a "get nearest intersection" example? If it is not too much to ask. Thanks in advance. Oct 15, 2020 at 12:21

1 Answer 1


You can try something like this :

node(around:80,-2.9027958824455133, -79.02495784310128)->.aroundnodes;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.