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

Reverse geocode to full address

1

Using Nominatim, I'm able to retrieve a full address from a reverse search. I click in the map, generating a lat/lon value for my click and it will bring back a full address, as such:

http://nominatim.openstreetmap.org/reverse.php?format=html&lat=53.1072166918934&lon=-2.3291015625&zoom=

If I query either raw OSM data (HERE) I'm only able to see the street name. Where is OSM getting the rest of the data from? Am I able to achieve a similar level of depth?

I'm currently running a web server hosting OSRM and a C# application feeding in queries, but I'm only ever able to get a street name back instead of a full address...

asked 15 Aug '16, 14:54

JamesGould's gravatar image

JamesGould
19691020
accept rate: 33%


2 Answers:

6

The answer is Nominatim.

Nominatim builds an address hierarchy using information from the element's address tags and associatedStreet relations, places in the element's proximity, administrative boundaries enclosing the element and so on. Some of these steps are explained at the development overview.

If you open your link and click on details you can see the address hierarchy Nominatim has built and which other OSM elements were used to create this hierarchy.

Also note that there are some other geocoders for OSM.

answered 15 Aug '16, 16:48

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

edited 15 Aug '16, 19:04

1

I also thought that Nominatim included a few other sources than just pure OSM data (e.g. Tiger address data)

(16 Aug '16, 09:50) escada

Yes, for the US Nominatim also uses Tiger address data as far as I know. Maybe similar additional data is used for some other countries. I still haven't found any good documentation for all this stuff.

(16 Aug '16, 09:53) scai ♦

-1
SELECT string_agg( place,',') as place FROM (
SELECT name AS PLACE, SUBSTRING(planet_osm_polygon.admin_level FROM '[0-9]{1,2}')::INT AS admin_level_int
FROM
planet_osm_polygon
WHERE
boundary = 'administrative' AND
ST_Intersects('SRID=4326;POINT(78.44131 17.51671)'::geometry, way)
ORDER BY admin_level_int desc
) AS geocoder


output: Ward 129 Suraram, Greater Hyderabad Municipal Corporation North Zone, Hyderabad, Medchal-Malkajgiri District, Telangana
if you get mixed SRID geometries error change 'way' as ST_Transform(way,4326)

answered 30 May '19, 10:43

Prasad%20Raju%20Vegesna's gravatar image

Prasad Raju ...
0
accept rate: 0%

Source code available on GitHub .