From 0bcc14afbbff529e6f1f62e9b1230d8983287765 Mon Sep 17 00:00:00 2001 From: gwen Date: Mon, 2 Oct 2023 21:40:38 +0200 Subject: [PATCH] add image and add url in folium --- app/routes.py | 15 +++++++-------- app/templates/acte.html | 9 ++++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/routes.py b/app/routes.py index 2e8ae7a..c8423c5 100644 --- a/app/routes.py +++ b/app/routes.py @@ -72,7 +72,6 @@ def home(): bigram, number = trs['prince_code'].split('_') long_prince_bigram = inverted_prince_bigram(bigram) + '_' + number trs['prince_url'] = prince_name=long_prince_bigram.capitalize() - return render_template("plainsearch.html", search=search, actes=transformed_query) return render_template("home.html") @@ -142,14 +141,14 @@ def prince_corpus(house=None, prince=None): "analysis": '$analysis', "place": "$place.name", "diplo_state": "$diplo_state", - "diplo_type": "$diplo_type" + "diplo_type": "$diplo_type", + "image": "$image" } } } ])) transformed_query = [pr['_id'] for pr in query] invert_prince_bigram = {val: key for key, val in prince_bigram.items()} - # constructing the dateitem for trs in transformed_query: trs['dateitem'] = make_timeitem_from_filename(trs['filename']) @@ -179,7 +178,8 @@ def acte(house=None, prince=None, dateitem=None): #diplo=diplo_t[0].replace("_", " "), state=state[0], output_doc=result.get('xmlcontent'), name_prince=result.get("prince_name"), folium=result.get("folium"), - transcribers=result.get('transcribers')) + transcribers=result.get('transcribers'), + image=result.get('image')) @main.route("/geolocalisation") def geolocalisation(): @@ -187,18 +187,17 @@ def geolocalisation(): m = folium.Map(location=[46.603354, 1.888334], zoom_start=6) for result in actecol.find(): place = result['place'] + name = place['name'] + url = result['url'] if place.get('latitude') is not None: folium.Marker( location=[place['latitude'], place['longitude']], - popup=place['name'], + popup= f"{name}
Voir", icon=folium.Icon(color='lightgray', icon="circle", prefix='fa') #icon=folium.Icon(color='lightgray', icon='home', prefix='fa') ).add_to(m) geolocalisation = m._repr_html_() return render_template("map.html", geolocalisation=geolocalisation) - #geolocalisation = folium_map.find_one() - #geolocalisation = geolocalisation['globalmap'] - #return render_template("map.html", geolocalisation=geolocalisation) @main.route("/contact") def contact() -> t.Text: diff --git a/app/templates/acte.html b/app/templates/acte.html index 17cf0f0..46cb6f2 100644 --- a/app/templates/acte.html +++ b/app/templates/acte.html @@ -1,5 +1,6 @@ {% extends "container.html" %} {% block corps %} +