forked from edward/owl-map
Show street address for OSM candidates
This commit is contained in:
parent
f0cb54bf95
commit
53ca5b4ead
|
@ -196,7 +196,15 @@
|
|||
<a
|
||||
:href="'http://wiki.openstreetmap.org/wiki/' + p.tag_or_key"
|
||||
class="osm-wiki-link"
|
||||
target="_blank">{{p.name}} <i class="fa fa-external-link"></i></a>
|
||||
target="_blank"
|
||||
@click.stop>{{p.name}} <i class="fa fa-external-link"></i></a>
|
||||
</span>
|
||||
|
||||
<span v-if="osm.address">
|
||||
<br>street address: {{ osm.address }}
|
||||
</span>
|
||||
<span v-else-if="osm.tags['addr:street']">
|
||||
<br>street: {{ osm.tags['addr:street'] }}
|
||||
</span>
|
||||
|
||||
<span v-if="osm.address_list.length">
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue