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
|
<a
|
||||||
:href="'http://wiki.openstreetmap.org/wiki/' + p.tag_or_key"
|
:href="'http://wiki.openstreetmap.org/wiki/' + p.tag_or_key"
|
||||||
class="osm-wiki-link"
|
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>
|
||||||
|
|
||||||
<span v-if="osm.address_list.length">
|
<span v-if="osm.address_list.length">
|
||||||
|
|
|
@ -1028,6 +1028,9 @@ def get_part_of(thing, bbox):
|
||||||
|
|
||||||
def address_from_tags(tags):
|
def address_from_tags(tags):
|
||||||
keys = ["street", "housenumber"]
|
keys = ["street", "housenumber"]
|
||||||
|
if not all("addr:" + k in tags for k in keys):
|
||||||
|
return
|
||||||
|
|
||||||
if g.street_number_first:
|
if g.street_number_first:
|
||||||
keys.reverse()
|
keys.reverse()
|
||||||
return " ".join(tags["addr:" + k] for k in keys)
|
return " ".join(tags["addr:" + k] for k in keys)
|
||||||
|
@ -1064,6 +1067,9 @@ def api_find_osm_candidates(item_id):
|
||||||
if hasattr(osm, 'area'):
|
if hasattr(osm, 'area'):
|
||||||
cur["area"] = 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]
|
part_of = [i["name"] for i in get_part_of(osm, bounds) if i["name"] != name]
|
||||||
if part_of:
|
if part_of:
|
||||||
cur["part_of"] = part_of
|
cur["part_of"] = part_of
|
||||||
|
|
Loading…
Reference in a new issue