LaurentTRIPIED commited on
Commit
f0e7ec3
1 Parent(s): bcc1e2c
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -39,10 +39,17 @@ def display_map():
39
  if data:
40
  m = folium.Map(location=[44.84474, -0.60711], zoom_start=12)
41
  for item in data:
42
- if 'point_geo' in item and item['point_geo']:
43
- lat = float(item['point_geo']['lat'])
44
- lon = float(item['point_geo']['lon'])
45
- folium.Marker([lat, lon], popup=item.get("nom_courant_denomination", "Sans nom")).add_to(m)
 
 
 
 
 
 
 
46
  folium_static(m)
47
 
48
  # Fonction pour l'onglet "Dialoguer avec l'assistant IA RSE bziiit"
 
39
  if data:
40
  m = folium.Map(location=[44.84474, -0.60711], zoom_start=12)
41
  for item in data:
42
+ try:
43
+ # On tente d'extraire et de convertir lat et lon en flottants
44
+ lat = float(item.get('point_geo', {}).get('lat'))
45
+ lon = float(item.get('point_geo', {}).get('lon'))
46
+ # On vérifie que lat et lon ont été correctement convertis (ne sont pas NaN)
47
+ if lat and lon:
48
+ folium.Marker([lat, lon], popup=item.get("nom_courant_denomination", "Sans nom")).add_to(m)
49
+ except (ValueError, TypeError):
50
+ # Cette exception attrape les cas où la conversion en float échoue
51
+ # ou les valeurs de lat/lon ne sont pas présentes ou pas valides
52
+ continue
53
  folium_static(m)
54
 
55
  # Fonction pour l'onglet "Dialoguer avec l'assistant IA RSE bziiit"