[Geocoding] Country code for Hong Kong geocodes to "cn" instead of "hk"

Sarah Hoffmann lonvia at denofr.de
Sat Sep 1 08:25:24 UTC 2018


Hi,

On Fri, Aug 31, 2018 at 06:28:31PM +0530, Leo Orson wrote:
> Hello everyone,
> 
> I tried to geocode "Hong Kong"
> (https://nominatim.openstreetmap.org/search.php?q=Hong
> Kong&format=json&addressdetails=1&accept-language=en), and the country code
> comes out to be "cn".

Nominatim takes the country code from the country the place is in
which in this particular case is China.

> But according to this list (
> https://wiki.openstreetmap.org/wiki/Nominatim/Country_Codes), I found the
> country code for Hong Kong to be "HK", and hence I believe we should be
> getting HK instead of CN.

This list just contains the codes Nominatim knows about, not where they
are applied.

> I did some research and I believe the Relation: China (270056) (
> https://www.openstreetmap.org/relation/270056/history#map=6/20.056/114.675)
> is the reason. Not sure how to fix this, hence thought of mailing it here.

This is not a data error but a fundamental design issue with Nominatim
which cannot handle overlapping countries well (also an issue with
disputed areas). I've added the case to
https://github.com/openstreetmap/Nominatim/issues/202
but I'm sorry to say it is unlikely that this will get fixed any time soon.

Kind regards

Sarah



More information about the Geocoding mailing list