forked from edward/owl-map
Include more detail in OSM tags API call
This commit is contained in:
parent
c404c9a752
commit
22cfe64896
|
@ -495,12 +495,11 @@ def get_item_street_addresses(item):
|
||||||
def check_is_street_number_first(bounds):
|
def check_is_street_number_first(bounds):
|
||||||
g.street_number_first = is_street_number_first(*get_bbox_centroid(bounds))
|
g.street_number_first = is_street_number_first(*get_bbox_centroid(bounds))
|
||||||
|
|
||||||
def get_markers(all_items):
|
def item_detail(item):
|
||||||
items = []
|
|
||||||
for item in all_items:
|
|
||||||
if not item:
|
|
||||||
continue
|
|
||||||
locations = [list(i.get_lat_lon()) for i in item.locations]
|
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")
|
image_filenames = item.get_claim("P18")
|
||||||
|
|
||||||
street_address = get_item_street_addresses(item)
|
street_address = get_item_street_addresses(item)
|
||||||
|
@ -512,15 +511,18 @@ def get_markers(all_items):
|
||||||
"markers": locations,
|
"markers": locations,
|
||||||
"image_list": image_filenames,
|
"image_list": image_filenames,
|
||||||
"street_address": street_address,
|
"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():
|
if aliases := item.get_aliases():
|
||||||
d["aliases"] = 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):
|
def wikidata_items(bounds):
|
||||||
|
|
|
@ -284,12 +284,14 @@ def api_osm_objects():
|
||||||
def api_get_item_tags(item_id):
|
def api_get_item_tags(item_id):
|
||||||
t0 = time()
|
t0 = time()
|
||||||
item = model.Item.query.get(item_id)
|
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
|
t1 = time() - t0
|
||||||
|
|
||||||
return cors_jsonify(success=True,
|
return cors_jsonify(success=True,
|
||||||
qid=item.qid,
|
qid=item.qid,
|
||||||
tag_or_key_list=osm_list,
|
tag_or_key_list=osm_list,
|
||||||
|
tag_src=tags,
|
||||||
duration=t1)
|
duration=t1)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue