Commit
·
552a0b9
1
Parent(s):
d2adc5f
Pytorch V0.14
Browse files
app.py
CHANGED
|
@@ -10,7 +10,17 @@ def get_data():
|
|
| 10 |
if response.status_code == 200:
|
| 11 |
data = response.json()
|
| 12 |
records = data.get("records", [])
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
else:
|
| 15 |
return []
|
| 16 |
|
|
@@ -32,16 +42,13 @@ def display_organisations_engagees(data):
|
|
| 32 |
def display_map(data):
|
| 33 |
m = folium.Map(location=[44.837789, -0.57918], zoom_start=12)
|
| 34 |
for item in data:
|
| 35 |
-
|
| 36 |
-
if
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
icon=folium.Icon(color="green", icon="leaf"),
|
| 43 |
-
popup=item.get('nom_courant_denomination', 'Information non disponible'),
|
| 44 |
-
).add_to(m)
|
| 45 |
folium_static(m)
|
| 46 |
|
| 47 |
def main():
|
|
|
|
| 10 |
if response.status_code == 200:
|
| 11 |
data = response.json()
|
| 12 |
records = data.get("records", [])
|
| 13 |
+
cleaned_data = []
|
| 14 |
+
for record in records:
|
| 15 |
+
if record.get("fields"): # Filtre les éventuelles lignes vides
|
| 16 |
+
fields = record["fields"]
|
| 17 |
+
point_geo = fields.get("point_geo")
|
| 18 |
+
if point_geo: # Assure l'existence du champ point_geo
|
| 19 |
+
# Assigne les coordonnées directement aux champs pour faciliter l'accès
|
| 20 |
+
fields["latitude"] = point_geo["lat"]
|
| 21 |
+
fields["longitude"] = point_geo["lon"]
|
| 22 |
+
cleaned_data.append(fields)
|
| 23 |
+
return cleaned_data
|
| 24 |
else:
|
| 25 |
return []
|
| 26 |
|
|
|
|
| 42 |
def display_map(data):
|
| 43 |
m = folium.Map(location=[44.837789, -0.57918], zoom_start=12)
|
| 44 |
for item in data:
|
| 45 |
+
# Utilise les coordonnées directement extraites et stockées
|
| 46 |
+
if "latitude" in item and "longitude" in item:
|
| 47 |
+
folium.Marker(
|
| 48 |
+
[item["latitude"], item["longitude"]],
|
| 49 |
+
icon=folium.Icon(color="green", icon="leaf"),
|
| 50 |
+
popup=item.get('nom_courant_denomination', 'Information non disponible'),
|
| 51 |
+
).add_to(m)
|
|
|
|
|
|
|
|
|
|
| 52 |
folium_static(m)
|
| 53 |
|
| 54 |
def main():
|