diff --git a/app/routes.py b/app/routes.py index a3091c7..538665a 100644 --- a/app/routes.py +++ b/app/routes.py @@ -4,6 +4,7 @@ from unidecode import unidecode # to remove accents in house and prince names i from flask import Blueprint, abort, render_template, request, send_from_directory from pymongo import MongoClient +import folium from .config import dbadmin, dbpassword, server_ip from .helper import find_one_or_404 @@ -21,6 +22,7 @@ actesdb = dbclient["actesdb"] housecol = actesdb["house"] actecol = actesdb["acte"] helpers = actesdb["helpers"] +#folium_map = actesdb["folium_map"] # helpers_dicts = helpers.find_one() @@ -120,10 +122,28 @@ def acte(house=None, prince=None, dateitem=None): #infos=None, place=None, doc=None, arch=None, #diplo=diplo_t[0].replace("_", " "), state=state[0], output_doc=result.get('xmlcontent'), name_prince=result.get("prince_name"), - folium = result.get("folium"), + folium=result.get("folium"), transcribers=result.get('transcribers')) - +@main.route("/geoloc") +def geoloc(): + "global folium/leaflet map" + m = folium.Map(location=[46.603354, 1.888334], zoom_start=6) + for result in actecol.find(): + place = result['place'] + if place.get('latitude') is not None: + folium.Marker( + location=[place['latitude'], place['longitude']], + popup=place['name'], + #icon=folium.Icon(icon="cloud") + #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: """Displays the Contact page""" diff --git a/app/templates/about.html b/app/templates/about.html index b708e0c..08a3509 100644 --- a/app/templates/about.html +++ b/app/templates/about.html @@ -20,4 +20,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/templates/acte.html b/app/templates/acte.html index 0b37e85..17cf0f0 100644 --- a/app/templates/acte.html +++ b/app/templates/acte.html @@ -16,7 +16,7 @@
{{item.analysis}}.
{{state}}, {{diplo}}, {{arch}}, {{doc}}, {{item.ref_acte}}.
{% endfor %}--> - {{output_doc|safe}} + {{ output_doc | safe }}Transcription : diff --git a/app/templates/map.html b/app/templates/map.html new file mode 100644 index 0000000..2bb0e0b --- /dev/null +++ b/app/templates/map.html @@ -0,0 +1,5 @@ +{% extends "container.html" %} +{% block corps %} +