|
|
|
@ -24,6 +24,7 @@ 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
|
|
|
|
|
|
|
|
from folium.plugins import MarkerCluster
|
|
|
|
from pymongo import ASCENDING
|
|
|
|
from pymongo import ASCENDING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -191,6 +192,8 @@ 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)
|
|
|
|
|
|
|
|
marker_cluster = MarkerCluster().add_to(m)
|
|
|
|
|
|
|
|
|
|
|
|
markers = defaultdict(list)
|
|
|
|
markers = defaultdict(list)
|
|
|
|
|
|
|
|
|
|
|
|
for result in actecol.find():
|
|
|
|
for result in actecol.find():
|
|
|
|
@ -208,7 +211,7 @@ def geolocalisation():
|
|
|
|
latitude = value[0][1]
|
|
|
|
latitude = value[0][1]
|
|
|
|
longitude = value[0][2]
|
|
|
|
longitude = value[0][2]
|
|
|
|
urls = [(url[0], url[3]) for url in value]
|
|
|
|
urls = [(url[0], url[3]) for url in value]
|
|
|
|
#print("urls", urls)
|
|
|
|
# print("urls", urls)
|
|
|
|
popup = [f"{name}<br/>"]
|
|
|
|
popup = [f"{name}<br/>"]
|
|
|
|
for location, see in urls:
|
|
|
|
for location, see in urls:
|
|
|
|
popup.append(f"<a href='{location}' target='_top'>{see}</a><br/>")
|
|
|
|
popup.append(f"<a href='{location}' target='_top'>{see}</a><br/>")
|
|
|
|
@ -216,9 +219,10 @@ def geolocalisation():
|
|
|
|
if latitude is not None:
|
|
|
|
if latitude is not None:
|
|
|
|
folium.Marker(
|
|
|
|
folium.Marker(
|
|
|
|
location=[latitude, longitude],
|
|
|
|
location=[latitude, longitude],
|
|
|
|
popup= popup,
|
|
|
|
popup=popup,
|
|
|
|
icon=folium.Icon(color='lightgray', icon="circle", prefix='fa')
|
|
|
|
icon=folium.Icon(color='lightgray', icon="circle", prefix='fa')
|
|
|
|
).add_to(m)
|
|
|
|
).add_to(marker_cluster)
|
|
|
|
|
|
|
|
# to remove marker_cluster : .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)
|
|
|
|
|