Spaces:
Runtime error
Runtime error
import folium | |
# Define the dictionary containing the bird species data | |
birds = [ | |
{ | |
'species': 'Canada Goose', | |
'lat': 44.9778, | |
'lon': -93.2650, | |
'start_month': 'September', | |
'end_month': 'April' | |
}, | |
{ | |
'species': 'Mallard Duck', | |
'lat': 44.8835, | |
'lon': -93.2273, | |
'start_month': 'August', | |
'end_month': 'May' | |
}, | |
{ | |
'species': 'Wood Duck', | |
'lat': 44.9778, | |
'lon': -93.2650, | |
'start_month': 'March', | |
'end_month': 'November' | |
}, | |
{ | |
'species': 'Trumpeter Swan', | |
'lat': 45.0941, | |
'lon': -94.2392, | |
'start_month': 'October', | |
'end_month': 'April' | |
}, | |
{ | |
'species': 'Tundra Swan', | |
'lat': 44.9358, | |
'lon': -93.1553, | |
'start_month': 'November', | |
'end_month': 'April' | |
}, | |
{ | |
'species': 'Canvasback', | |
'lat': 44.8835, | |
'lon': -93.2273, | |
'start_month': 'September', | |
'end_month': 'May' | |
}, | |
{ | |
'species': 'Redhead', | |
'lat': 44.9778, | |
'lon': -93.2650, | |
'start_month': 'September', | |
'end_month': 'May' | |
}, | |
{ | |
'species': 'Greater Scaup', | |
'lat': 44.8835, | |
'lon': -93.2273, | |
'start_month': 'September', | |
'end_month': 'May' | |
}, | |
{ | |
'species': 'Lesser Scaup', | |
'lat': 44.9778, | |
'lon': -93.2650, | |
'start_month': 'September', | |
'end_month': 'May' | |
}, | |
{ | |
'species': 'Hooded Merganser', | |
'lat': 44.8835, | |
'lon': -93.2273, | |
'start_month': 'October', | |
'end_month': 'April' | |
} | |
] | |
# Create a Folium map with the initial location and zoom level | |
m = folium.Map(location=[44.9778, -93.2650], zoom_start=8) | |
# Add markers for each bird species | |
for bird in birds: | |
# Get the species, latitude, longitude, start month, and end month from the dictionary | |
species = bird['species'] | |
lat = bird['lat'] | |
lon = bird['lon'] | |
start_month = bird['start_month'] | |
end_month = bird['end_month'] | |
# Create a popup message for the marker | |
popup_msg = f"{species}: {start_month} - {end_month}" | |
# Add a marker to the map with the latitude, longitude, and popup message | |
marker = folium.Marker(location=[lat, lon], popup=popup_msg) | |
# Add the species, start month, and end month to the marker icon | |
icon_text = f"{species} ({start_month} - {end_month})" | |
icon = folium.Icon(color='red', icon='glyphicon-map-marker', prefix='glyphicon') | |
marker.add_child(folium.Popup(icon_text)) | |
marker.add_to(m) | |
# This code will create a Folium map with markers for each bird species in the given dictionary, including the species name, start month, and end month on the markers. The marker icons are red and shaped like a map marker, and the labels are displayed in a popup when the marker is clicked. You can customize the map further by adjusting the map style, marker icons, and label formatting. | |
# create a press release for Yolo and Coco the two AI programs that can detect 25 different types of objects in live video. Make the press release full of emojis and write an exciting funny article written for grade school reading level | |
# Why do Canada Geese fly north during the winter and what places near MN do they go? | |
# create a streamlit folium map showing the migratory pattern of the canada goose in the united states and canada. Include the month and where they are likely to be | |
# create a dictionary list in python with the migratory goose data from the Cornell Lab of Ornithology and eBird data | |
# create the example again with top ten birds from minnesota including geese swans and ducks using the python dictionary | |