mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-06 21:01:53 +02:00
Issue #67: fix address processing.
This commit is contained in:
parent
e9933e9f2b
commit
a73006e67e
2 changed files with 9 additions and 18 deletions
|
@ -36,6 +36,8 @@
|
||||||
<w>subattributes</w>
|
<w>subattributes</w>
|
||||||
<w>subelement</w>
|
<w>subelement</w>
|
||||||
<w>subparser</w>
|
<w>subparser</w>
|
||||||
|
<w>subtile</w>
|
||||||
|
<w>subtiles</w>
|
||||||
<w>svgwrite</w>
|
<w>svgwrite</w>
|
||||||
<w>taginfo</w>
|
<w>taginfo</w>
|
||||||
<w>temaki</w>
|
<w>temaki</w>
|
||||||
|
|
|
@ -36,26 +36,15 @@ def get_address(
|
||||||
"""
|
"""
|
||||||
address: list[str] = []
|
address: list[str] = []
|
||||||
|
|
||||||
|
tag_names: list[str] = ["housenumber"]
|
||||||
if draw_captions_mode == "address":
|
if draw_captions_mode == "address":
|
||||||
if "addr:postcode" in tags:
|
tag_names += ["postcode", "country", "city", "street"]
|
||||||
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")
|
|
||||||
|
|
||||||
if "addr:housenumber" in tags:
|
for tag_name in tag_names:
|
||||||
address.append(tags["addr:housenumber"])
|
key: str = f"addr:{tag_name}"
|
||||||
processed.add("addr:housenumber")
|
if key in tags:
|
||||||
|
address.append(tags[key])
|
||||||
|
processed.add(key)
|
||||||
|
|
||||||
return address
|
return address
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue