NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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.

asked 05 Jun '18, 18:02

Taras%20O's gravatar image

Taras O
36336
accept rate: 0%


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.

permanent link

answered 06 Jun '18, 09:57

alan_gr's gravatar image

alan_gr
2.6k12245
accept rate: 15%

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

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×689
×107
×99
×58
×9

question asked: 05 Jun '18, 18:02

question was seen: 3,432 times

last updated: 06 Jun '18, 20:53

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum