Issue #67: fix address processing.

This commit is contained in:
Sergey Vartanov 2021-11-01 23:45:07 +03:00
parent e9933e9f2b
commit a73006e67e
2 changed files with 9 additions and 18 deletions

View file

@ -36,26 +36,15 @@ def get_address(
"""
address: list[str] = []
tag_names: list[str] = ["housenumber"]
if draw_captions_mode == "address":
if "addr:postcode" in tags:
address.append(tags["addr:postcode"])
processed.add("addr:postcode")
if "addr:country" in tags:
address.append(tags["addr:country"])
processed.add("addr:country")
if "addr:city" in tags:
address.append(tags["addr:city"])
processed.add("addr:city")
if "addr:street" in tags:
street = tags["addr:street"]
if street.startswith("улица "):
street = "ул. " + street[len("улица ") :]
address.append(street)
processed.add("addr:street")
tag_names += ["postcode", "country", "city", "street"]
if "addr:housenumber" in tags:
address.append(tags["addr:housenumber"])
processed.add("addr:housenumber")
for tag_name in tag_names:
key: str = f"addr:{tag_name}"
if key in tags:
address.append(tags[key])
processed.add(key)
return address