File size: 2,924 Bytes
adce761
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b0e8dc8
 
 
 
 
 
 
 
 
 
adce761
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Northern.Lights.Map.Streamlit.Folium - write a streamlit python program that uses functions and user interface elements of a textbox, a dial, a four direction button array for up down left right and display a folium map with the data in python list dictionaries with these values: Aurora Spottings, Notifications on Nerthern Lights, Northern lights map location cities and countries for Iceland on a map written with folium for latitude and longitude of top ten places to view Northern Lights.  Cite References as urls.
import streamlit as st
import folium
from folium import Marker

# Top 10 locations for viewing Northern Lights in Iceland
northern_lights_locations = [
    {"name": "Reykjavik", "lat": 64.1265, "lon": -21.8174},
    {"name": "Akureyri", "lat": 65.6885, "lon": -18.1262},
    {"name": "Vik", "lat": 63.4194, "lon": -19.0096},
    {"name": "Hofn", "lat": 64.2539, "lon": -15.2082},
    {"name": "Husavik", "lat": 66.0449, "lon": -17.3382},
    {"name": "Grundarfjordur", "lat": 64.9226, "lon": -23.2543},
    {"name": "Egilsstadir", "lat": 65.2669, "lon": -14.3948},
    {"name": "Seydisfjordur", "lat": 65.2592, "lon": -14.0101},
    {"name": "Isafjordur", "lat": 66.0750, "lon": -23.1266},
    {"name": "Kirkjufell", "lat": 64.9426, "lon": -23.3061},
]

def display_map(locations):
    # Create a folium map centered in Iceland
    iceland_map = folium.Map(location=[64.9631, -19.0208], zoom_start=6)

    # Add markers for the top 10 locations for viewing Northern Lights
    for location in locations:
        Marker(
            [location["lat"], location["lon"]],
            popup=f"<b>{location['name']}</b>",
        ).add_to(iceland_map)

    return iceland_map

# Streamlit app
st.title("Top 10 Locations to View Northern Lights in Iceland")

# Textbox
user_text = st.text_input("Enter your text:")

# Dial
dial_value = st.slider("Select a value:", 0, 100)

# Four-direction button array
st.write("Four-direction button array:")
col1, col2, col3 = st.columns(3)
with col2:
    st.button("Up")
with col1:
    st.button("Left")
with col3:
    st.button("Right")
with col2:
    st.button("Down")

# Display Folium map
st.write("Top 10 locations for viewing the Northern Lights in Iceland:")
folium_map = display_map(northern_lights_locations)
from streamlit_folium import st_folium

# center on Liberty Bell, add marker
m = folium.Map(location=[39.949610, -75.150282], zoom_start=16)
folium.Marker(
    [39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell"
).add_to(m)

# call to render Folium map in Streamlit
st_data = st_folium(m, width=725)
folium_static(folium_map)

# Cite references
st.write(
    """
    References:
    - [Folium documentation](https://python-visualization.github.io/folium/)
    - [Streamlit documentation](https://docs.streamlit.io/)
    - [Top 10 locations](https://www.guidetoiceland.is/best-of-iceland/top-10-places-to-see-the-northern-lights)
"""
)