From: Sarah Hoffmann Date: Fri, 26 May 2023 09:43:11 +0000 (+0200) Subject: fix geocodejson address assignment X-Git-Tag: v4.3.0~74^2~7 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/0843fefad3c5f4bb669ce10ae4cee89361166bb8 fix geocodejson address assignment The categories should be assigned the address part with the highest address rank not lowest. --- diff --git a/nominatim/api/v1/format_json.py b/nominatim/api/v1/format_json.py index 0907c955..99a3f182 100644 --- a/nominatim/api/v1/format_json.py +++ b/nominatim/api/v1/format_json.py @@ -54,7 +54,10 @@ def _write_geocodejson_address(out: JsonWriter, out.keyval('housenumber', line.local_name) elif (obj_place_id is None or obj_place_id != line.place_id) \ and line.rank_address >= 4 and line.rank_address < 28: - extra[GEOCODEJSON_RANKS[line.rank_address]] = line.local_name + rank_name = GEOCODEJSON_RANKS[line.rank_address] + if rank_name not in extra: + extra[rank_name] = line.local_name + for k, v in extra.items(): out.keyval(k, v)