The below 2 links return slightly different results. At zoom level 10 country code is returned "SN" and country name goes along with it ("Senegal"): https://nominatim.openstreetmap.org/reverse?format=xml&lat=13.35228&lon=-15.67002&zoom=10 At zoom level 18, when it supposed to be a more accurate result, it returns country code only "SN" https://nominatim.openstreetmap.org/reverse?format=xml&lat=13.35228&lon=-15.67002&zoom=18 What is odd, is that having country code, it is basically the same information for the country name. I understand that those are different "place ids" and "osm ids" and "osm types", but still doesn't seem correct to me. Any suggestions on how to address it would be appreciated. |
I am not an expert on Nominatim but as nobody else has answered... Maybe it is related to the fact that the zoom 18 result is for a way (road) that is partly outside Senegal - see https://nominatim.openstreetmap.org/details.php?place_id=161282086 Moving the lat/lon slightly so that it is closer to a way that is entirely inside Senegal seems to return the country name, e.g. https://nominatim.openstreetmap.org/reverse.php?format=html&lat=13.347182361714394&lon=-15.65073680903879&zoom=18 That doesn't really explain the difference between country name and country code though. 1
You're right. In Nominatim every map feature is assigned exactly one country_code during import and data updates. It's tricky (and a limitation of Nominatim) when roads cross country borders. In this case the correct country_code is returned at least. But the road is not completely inside Senegal so the spatial query looking for administrative boundaries sees the country (gray-ed on https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=422943503) but doesn't consider it part of the address. It doesn't happen with a nearby road that doesn't cross the border https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=422943515 Usually the recommendation is to split the OSM way at the country border. For an unnamed road and since the correct country(code) was assigned I'd say an unnecessary work-around. See also https://github.com/openstreetmap/Nominatim/issues/844
(06 Jun '18, 12:08)
mtmail
Thank you alan_gr and mtmail! That explains it.
(06 Jun '18, 20:15)
Taras O
I actually just discovered something else. I have an older OSM version running on an internal server (2.x) and it returns the JSON for the same query (zoom 18): {"place_id":"128323717","licence":"Data © OpenStreetMap contributors, ODbL 1.0. http:\/\/www.openstreetmap.org\/copyright","osm_type":"way","osm_id":"301447252","lat":"13.28023","lon":"-15.6339599","place_rank":"26","category":"highway","type":"track","importance":"0.1","addresstype":"road","display_name":"Saré Alkaly - Boghal - Ndiamacouta, Ndiamacouta (Chef lieu de commune), Arrondissement de Bounkiling, Sédhiou, Sédhiou Region, Senegal","name":"Saré Alkaly - Boghal - Ndiamacouta","address":{"road":"Saré Alkaly - Boghal - Ndiamacouta","village":"Ndiamacouta (Chef lieu de commune)","county":"Arrondissement de Bounkiling","state":"Sédhiou","country":"Senegal","country_code":"sn"}} However, the OSM id seems to be different.
(06 Jun '18, 20:53)
Taras O
|