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

How to get Node OSM id from position (lat, lon)

0

I am trying to get the nearest Node's OSM id from some position (given latitude and longitude) by doing a request to nominatim reverse endpoint, but I always get the nearest Way. The only reference I get to the nearest Node is its position (again latitude and longitude), but not its OSM id.

Is there a way to get the OSM id of the nearest Node to some position?

asked 21 May '19, 11:06

Axel%20Afonso's gravatar image

Axel Afonso
11112
accept rate: 0%


One Answer:

1

Nominatim's database only contains named nodes, or those relevant for addresses. So a bus stop can be relevant, but a park bench or empty building won't.

I think the openstreetmap.org website uses https://wiki.openstreetmap.org/wiki/Overpass_API#Around for the 'what's here?' feature. I mean the pointer with question mark button on the right-hand side of the map.

answered 21 May '19, 14:16

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Source code available on GitHub .