Spaces:
Running
Running
LaurentTRIPIED
commited on
Commit
•
70b5611
1
Parent(s):
27cfa3c
V1-Liste_MAP_02
Browse files- localisation.py +9 -4
localisation.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
-
import requests
|
2 |
from folium import Map, Marker, Icon, Popup
|
3 |
from streamlit_folium import folium_static
|
4 |
import streamlit as st
|
5 |
from data_manager import get_data
|
6 |
|
7 |
def display_map():
|
8 |
-
data,
|
9 |
if data:
|
|
|
|
|
|
|
10 |
m = Map(location=[44.84474, -0.60711], zoom_start=12)
|
11 |
for item in data:
|
12 |
try:
|
@@ -14,7 +16,6 @@ def display_map():
|
|
14 |
if point_geo:
|
15 |
lat, lon = float(point_geo[0]), float(point_geo[1])
|
16 |
if lat and lon:
|
17 |
-
# Définition du contenu HTML avec style CSS pour élargir le popup
|
18 |
popup_html = f"""
|
19 |
<div style="width:300px;">
|
20 |
<b>{item.get('nom_courant_denomination', 'Sans nom')}</b><br>
|
@@ -22,11 +23,15 @@ def display_map():
|
|
22 |
{item.get('action_rse', 'Non spécifiée')}
|
23 |
</div>
|
24 |
"""
|
25 |
-
popup = Popup(popup_html, max_width=500)
|
26 |
Marker([lat, lon], popup=popup, icon=Icon(color='green', icon='leaf', prefix='fa')).add_to(m)
|
27 |
except (ValueError, TypeError, IndexError):
|
28 |
continue
|
|
|
29 |
folium_static(m)
|
|
|
|
|
|
|
30 |
|
31 |
if __name__ == "__main__":
|
32 |
display_map()
|
|
|
|
|
1 |
from folium import Map, Marker, Icon, Popup
|
2 |
from streamlit_folium import folium_static
|
3 |
import streamlit as st
|
4 |
from data_manager import get_data
|
5 |
|
6 |
def display_map():
|
7 |
+
data, total_hits = get_data() # Assurez-vous que get_data() retourne également total_hits
|
8 |
if data:
|
9 |
+
# Message au-dessus de la carte
|
10 |
+
st.markdown("Cliquer sur l'icône pour découvrir l'entreprise et une de ses actions RSE remarquable")
|
11 |
+
|
12 |
m = Map(location=[44.84474, -0.60711], zoom_start=12)
|
13 |
for item in data:
|
14 |
try:
|
|
|
16 |
if point_geo:
|
17 |
lat, lon = float(point_geo[0]), float(point_geo[1])
|
18 |
if lat and lon:
|
|
|
19 |
popup_html = f"""
|
20 |
<div style="width:300px;">
|
21 |
<b>{item.get('nom_courant_denomination', 'Sans nom')}</b><br>
|
|
|
23 |
{item.get('action_rse', 'Non spécifiée')}
|
24 |
</div>
|
25 |
"""
|
26 |
+
popup = Popup(popup_html, max_width=500)
|
27 |
Marker([lat, lon], popup=popup, icon=Icon(color='green', icon='leaf', prefix='fa')).add_to(m)
|
28 |
except (ValueError, TypeError, IndexError):
|
29 |
continue
|
30 |
+
|
31 |
folium_static(m)
|
32 |
+
|
33 |
+
# Message et nombre d'organisations en dessous de la carte
|
34 |
+
st.markdown(f"* Nombre d'organisations : {total_hits}")
|
35 |
|
36 |
if __name__ == "__main__":
|
37 |
display_map()
|