Include more detail in OSM tags API call

This commit is contained in:
Edward Betts 2021-07-03 13:39:37 +02:00
parent c404c9a752
commit 22cfe64896
2 changed files with 30 additions and 26 deletions

View file

@ -495,12 +495,11 @@ def get_item_street_addresses(item):
def check_is_street_number_first(bounds):
g.street_number_first = is_street_number_first(*get_bbox_centroid(bounds))
def get_markers(all_items):
items = []
for item in all_items:
if not item:
continue
def item_detail(item):
locations = [list(i.get_lat_lon()) for i in item.locations]
if not hasattr(g, 'street_number_first'):
g.street_number_first = is_street_number_first(*locations[0])
image_filenames = item.get_claim("P18")
street_address = get_item_street_addresses(item)
@ -512,15 +511,18 @@ def get_markers(all_items):
"markers": locations,
"image_list": image_filenames,
"street_address": street_address,
"isa_list": [v["id"] for v in item.get_claim("P31") if v],
"isa_list": item.get_isa_qids(),
"closed": item.closed(),
}
if aliases := item.get_aliases():
d["aliases"] = aliases
items.append(d)
return d
return items
def get_markers(all_items):
return [item_detail(item) for item in all_items if item]
def wikidata_items(bounds):

View file

@ -284,12 +284,14 @@ def api_osm_objects():
def api_get_item_tags(item_id):
t0 = time()
item = model.Item.query.get(item_id)
osm_list = api.get_item_tags(item)
tags = api.get_item_tags(item)
osm_list = sorted(tags.keys())
t1 = time() - t0
return cors_jsonify(success=True,
qid=item.qid,
tag_or_key_list=osm_list,
tag_src=tags,
duration=t1)