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

Incorrect data received in reverse geocoding

0

Hi,

Got a location(lat&lon) from a geocode response. Then tried to reverse geocoding with that location(exact lat & lon), But got some other data with different lat & lon in response.

For Eg: http://nominatim.openstreetmap.org/search?format=json&polygon_geojson=1&q=vellore,%20tamilnadu

Get lat & lon of 1st data(lat=12.9071753&lon=79.1309695).

http://nominatim.openstreetmap.org/reverse?format=xml&lat=12.9071753&lon=79.1309695&addressdetails=1

Check reverse geocoding response, expect the same data(which got in geocoding), but getting different data.

asked 03 Jan '18, 10:27

Rajavelu_M's gravatar image

Rajavelu_M
253454858
accept rate: 33%

edited 03 Jan '18, 10:58

Maybe the reverse geocoding tries to search for the nearest POI. The geocoding query returns the city node because that's what you've been searching for. The reverse geocoding query instead returns a school node which I consider to be more relevant than a somewhat arbitrarily placed city node. Could be just a coincidence, though.

(03 Jan '18, 11:21) scai ♦

One Answer:

2

reverse and search are not inverse operations of each other. They use the same database and produce a similar looking output format but that is all. They use completely different algorithms to compute the respective results.

In the particular example search returns the centre coordinates for the town you are looking for and reverse then returns the closest object to that centre. It tries to be as precise as possible, so preferably returns a street or address with house number or a POI like, as in this case, a school building. Your original town is still contained in the response in the address part. So the result is not wrong, just more precise than you expected.

answered 03 Jan '18, 11:37

lonvia's gravatar image

lonvia
6.2k25789
accept rate: 40%

Source code available on GitHub .