Show 'part of' in candidate list
This commit is contained in:
parent
9457d423aa
commit
53ba0d7845
|
@ -146,6 +146,11 @@
|
||||||
<span v-if="osm.address_list.length">
|
<span v-if="osm.address_list.length">
|
||||||
<br>address nodes: {{ osm.address_list.join("; ") }}
|
<br>address nodes: {{ osm.address_list.join("; ") }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span v-if="osm.part_of">
|
||||||
|
<br>part of: {{ osm.part_of.join("; ") }}
|
||||||
|
</span>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
19
web_view.py
19
web_view.py
|
@ -951,6 +951,21 @@ def get_address_nodes_within_building(building, bbox):
|
||||||
|
|
||||||
return [node.tags for node in q]
|
return [node.tags for node in q]
|
||||||
|
|
||||||
|
def get_part_of(thing, bbox):
|
||||||
|
db_bbox = make_envelope(bbox)
|
||||||
|
ewkt = thing.as_EWKT
|
||||||
|
q = model.Polygon.query.filter(
|
||||||
|
func.ST_Intersects(db_bbox, model.Polygon.way),
|
||||||
|
func.ST_Covers(model.Polygon.way, func.ST_GeomFromEWKT(ewkt)),
|
||||||
|
or_(
|
||||||
|
model.Polygon.tags.has_key("landuse"),
|
||||||
|
model.Polygon.tags.has_key("amenity"),
|
||||||
|
),
|
||||||
|
model.Polygon.tags.has_key("name"),
|
||||||
|
)
|
||||||
|
|
||||||
|
return [polygon.tags for polygon in q]
|
||||||
|
|
||||||
def address_from_tags(tags):
|
def address_from_tags(tags):
|
||||||
keys = ["street", "housenumber"]
|
keys = ["street", "housenumber"]
|
||||||
if g.street_number_first:
|
if g.street_number_first:
|
||||||
|
@ -989,6 +1004,10 @@ def api_find_osm_candidates(item_id):
|
||||||
if hasattr(osm, 'area'):
|
if hasattr(osm, 'area'):
|
||||||
cur["area"] = osm.area
|
cur["area"] = osm.area
|
||||||
|
|
||||||
|
part_of = [i["name"] for i in get_part_of(osm, bounds) if i["name"] != name]
|
||||||
|
if part_of:
|
||||||
|
cur["part_of"] = part_of
|
||||||
|
|
||||||
nearby.append(cur)
|
nearby.append(cur)
|
||||||
|
|
||||||
t1 = time() - t0
|
t1 = time() - t0
|
||||||
|
|
Loading…
Reference in a new issue