From 53ca5b4eadcd616bf3f36dcbd3928b5cf4afd3d9 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 17 Jun 2021 19:16:32 +0200 Subject: [PATCH] Show street address for OSM candidates --- frontend/App.vue | 10 +++++++++- web_view.py | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/App.vue b/frontend/App.vue index 89ea390..a6f5805 100644 --- a/frontend/App.vue +++ b/frontend/App.vue @@ -196,7 +196,15 @@ {{p.name}} + target="_blank" + @click.stop>{{p.name}} + + + +
street address: {{ osm.address }} +
+ +
street: {{ osm.tags['addr:street'] }}
diff --git a/web_view.py b/web_view.py index d686230..d9bc062 100755 --- a/web_view.py +++ b/web_view.py @@ -1028,6 +1028,9 @@ def get_part_of(thing, bbox): def address_from_tags(tags): keys = ["street", "housenumber"] + if not all("addr:" + k in tags for k in keys): + return + if g.street_number_first: keys.reverse() return " ".join(tags["addr:" + k] for k in keys) @@ -1064,6 +1067,9 @@ def api_find_osm_candidates(item_id): if hasattr(osm, 'area'): cur["area"] = osm.area + if address := address_from_tags(tags): + cur["address"] = address + part_of = [i["name"] for i in get_part_of(osm, bounds) if i["name"] != name] if part_of: cur["part_of"] = part_of