Update app.py
Browse files
app.py
CHANGED
@@ -365,12 +365,15 @@ def flight_tracking(flight_view_level, country, local_time_zone, flight_info, ai
|
|
365 |
# Get cached airport data
|
366 |
airport_df = load_airport_data()
|
367 |
airport_locations = airport_df[["Name", "City", "Country", "IATA/FAA", "Latitude", "Longitude"]]
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
374 |
|
375 |
# Get traffic data
|
376 |
geo_df = get_traffic_gdf(lat_min, lat_max, lon_min, lon_max, local_time_zone, loc, flight_info)
|
@@ -510,12 +513,23 @@ def flight_tracking(flight_view_level, country, local_time_zone, flight_info, ai
|
|
510 |
# Add airports if selected
|
511 |
if airport == 1:
|
512 |
for idx, row in airport_country_loc.iterrows():
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
|
520 |
# Add colormap to the map
|
521 |
colormap.add_to(m)
|
|
|
365 |
# Get cached airport data
|
366 |
airport_df = load_airport_data()
|
367 |
airport_locations = airport_df[["Name", "City", "Country", "IATA/FAA", "Latitude", "Longitude"]]
|
368 |
+
|
369 |
+
# Filter airports for the selected country and within the view bounds
|
370 |
+
airport_country_loc = airport_locations[
|
371 |
+
(airport_locations['Country'].str.contains(str(loc[0]), case=False, na=False)) &
|
372 |
+
(airport_locations['Latitude'] >= lat_min) &
|
373 |
+
(airport_locations['Latitude'] <= lat_max) &
|
374 |
+
(airport_locations['Longitude'] >= lon_min) &
|
375 |
+
(airport_locations['Longitude'] <= lon_max)
|
376 |
+
]
|
377 |
|
378 |
# Get traffic data
|
379 |
geo_df = get_traffic_gdf(lat_min, lat_max, lon_min, lon_max, local_time_zone, loc, flight_info)
|
|
|
513 |
# Add airports if selected
|
514 |
if airport == 1:
|
515 |
for idx, row in airport_country_loc.iterrows():
|
516 |
+
if pd.notna(row['Latitude']) and pd.notna(row['Longitude']):
|
517 |
+
folium.Marker(
|
518 |
+
location=[row['Latitude'], row['Longitude']],
|
519 |
+
icon=folium.Icon(icon='plane', prefix='fa', color='blue'),
|
520 |
+
popup=folium.Popup(
|
521 |
+
f"""
|
522 |
+
<div style="font-size: 14px; font-family: Arial, sans-serif;">
|
523 |
+
<b>{row['Name']}</b><br>
|
524 |
+
IATA: {row['IATA/FAA']}<br>
|
525 |
+
City: {row['City']}<br>
|
526 |
+
Country: {row['Country']}
|
527 |
+
</div>
|
528 |
+
""",
|
529 |
+
max_width=300
|
530 |
+
),
|
531 |
+
tooltip=f"Airport: {row['Name']}"
|
532 |
+
).add_to(m)
|
533 |
|
534 |
# Add colormap to the map
|
535 |
colormap.add_to(m)
|