|
|
|
@ -19,7 +19,7 @@ Then the 'dynamic' (calculated) routes :
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
import typing as t
|
|
|
|
import typing as t
|
|
|
|
|
|
|
|
from collections import defaultdict
|
|
|
|
|
|
|
|
|
|
|
|
from flask import Blueprint, render_template, request, url_for, redirect
|
|
|
|
from flask import Blueprint, render_template, request, url_for, redirect
|
|
|
|
import folium
|
|
|
|
import folium
|
|
|
|
@ -189,18 +189,35 @@ def geolocalisation():
|
|
|
|
actes=plaintext_response(search, actecol, prince_bigram))
|
|
|
|
actes=plaintext_response(search, actecol, prince_bigram))
|
|
|
|
|
|
|
|
|
|
|
|
m = folium.Map(location=[46.603354, 1.888334], zoom_start=6)
|
|
|
|
m = folium.Map(location=[46.603354, 1.888334], zoom_start=6)
|
|
|
|
|
|
|
|
markers = defaultdict(list)
|
|
|
|
|
|
|
|
|
|
|
|
for result in actecol.find():
|
|
|
|
for result in actecol.find():
|
|
|
|
place = result['place']
|
|
|
|
place = result['place']
|
|
|
|
|
|
|
|
filename = result['filename']
|
|
|
|
name = place['name']
|
|
|
|
name = place['name']
|
|
|
|
|
|
|
|
place_name = name.lower()
|
|
|
|
url = result['url']
|
|
|
|
url = result['url']
|
|
|
|
if place.get('latitude') is not None:
|
|
|
|
latitude = place['latitude']
|
|
|
|
|
|
|
|
longitude = place['longitude']
|
|
|
|
|
|
|
|
markers[place_name].append([url, latitude, longitude, filename])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for key, value in markers.items():
|
|
|
|
|
|
|
|
name = key.capitalize()
|
|
|
|
|
|
|
|
latitude = value[0][1]
|
|
|
|
|
|
|
|
longitude = value[0][2]
|
|
|
|
|
|
|
|
urls = [(url[0], url[3]) for url in value]
|
|
|
|
|
|
|
|
#print("urls", urls)
|
|
|
|
|
|
|
|
popup = [f"{name}<br/>"]
|
|
|
|
|
|
|
|
for location, see in urls:
|
|
|
|
|
|
|
|
popup.append(f"<a href='{location}' target='_top'>{see}</a><br/>")
|
|
|
|
|
|
|
|
popup = "".join(popup)
|
|
|
|
|
|
|
|
if latitude is not None:
|
|
|
|
folium.Marker(
|
|
|
|
folium.Marker(
|
|
|
|
location=[place['latitude'], place['longitude']],
|
|
|
|
location=[latitude, longitude],
|
|
|
|
popup= f"{name}<br/><a href='{url}' target='_top'>Voir</a>",
|
|
|
|
popup= popup,
|
|
|
|
icon=folium.Icon(color='lightgray', icon="circle", prefix='fa')
|
|
|
|
icon=folium.Icon(color='lightgray', icon="circle", prefix='fa')
|
|
|
|
#icon=folium.Icon(color='lightgray', icon='home', prefix='fa')
|
|
|
|
|
|
|
|
).add_to(m)
|
|
|
|
).add_to(m)
|
|
|
|
|
|
|
|
|
|
|
|
geolocalisation = m._repr_html_()
|
|
|
|
geolocalisation = m._repr_html_()
|
|
|
|
return render_template("map.html", geolocalisation=geolocalisation)
|
|
|
|
return render_template("map.html", geolocalisation=geolocalisation)
|
|
|
|
|
|
|
|
|
|
|
|
|