LaurentTRIPIED commited on
Commit
f266ac0
1 Parent(s): 09e0db5

Pytorch v.50

Browse files
Files changed (1) hide show
  1. localisation.py +12 -9
localisation.py CHANGED
@@ -1,5 +1,5 @@
1
  import requests
2
- from folium import Map, Marker, Icon
3
  from streamlit_folium import folium_static
4
  import streamlit as st
5
  from data_manager import get_data
@@ -12,15 +12,18 @@ def display_map():
12
  try:
13
  point_geo = item.get('point_geo', [])
14
  if point_geo:
15
- lat, lon = point_geo
16
- lat, lon = float(lat), float(lon)
17
  if lat and lon:
18
- popup_content = f"<b>{item.get('nom_courant_denomination', 'Sans nom')}</b><br>" \
19
- f"<b>Action RSE</b><br>" \
20
- f"{item.get('action_rse', 'Non spécifiée')}"
21
- Marker([lat, lon],
22
- popup=popup_content,
23
- icon=Icon(color='green', icon='leaf', prefix='fa')).add_to(m)
 
 
 
 
24
  except (ValueError, TypeError, IndexError):
25
  continue
26
  folium_static(m)
 
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
 
12
  try:
13
  point_geo = item.get('point_geo', [])
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>
21
+ <b>Action RSE:</b><br>
22
+ {item.get('action_rse', 'Non spécifiée')}
23
+ </div>
24
+ """
25
+ popup = Popup(popup_html, max_width=500) # Vous pouvez ajuster max_width comme souhaité
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)