Spaces:
Sleeping
Sleeping
Create backup.app.py
Browse files- backup.app.py +46 -0
backup.app.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import folium
|
3 |
+
from streamlit_folium import folium_static
|
4 |
+
|
5 |
+
# Define mythological places data for Iceland
|
6 |
+
mythological_places = [
|
7 |
+
('Ásbyrgi', 66.0082, -16.5096),
|
8 |
+
('Dimmuborgir', 65.6083, -16.8996),
|
9 |
+
('Hekla', 63.9920, -19.6656),
|
10 |
+
('Elliðaey', 63.4845, -20.2785),
|
11 |
+
('Mývatn', 65.6039, -16.9965),
|
12 |
+
('Djúpalónssandur', 64.7439, -23.9033),
|
13 |
+
('Reykjadalur', 64.0333, -21.2167),
|
14 |
+
('Snaefellsjokull', 64.8080, -23.7767),
|
15 |
+
('Jokulsarlon', 64.0784, -16.2300),
|
16 |
+
('Vatnajokull', 64.4150, -16.8333)
|
17 |
+
]
|
18 |
+
|
19 |
+
# Create a map centered on Iceland
|
20 |
+
m = folium.Map(location=[65.0, -18.0], zoom_start=7)
|
21 |
+
|
22 |
+
# Add markers for each mythological place
|
23 |
+
for place in mythological_places:
|
24 |
+
folium.Marker(
|
25 |
+
location=[place[1], place[2]],
|
26 |
+
popup=f'{place[0]}',
|
27 |
+
icon=folium.Icon(color='red')
|
28 |
+
).add_to(m)
|
29 |
+
|
30 |
+
# Function to update the map when a button is clicked
|
31 |
+
def update_map(place_data):
|
32 |
+
m.location = [place_data[1], place_data[2]]
|
33 |
+
m.zoom_start = 13
|
34 |
+
folium_static(m)
|
35 |
+
|
36 |
+
# Create a grid of buttons for selecting mythological places
|
37 |
+
for i in range(0, len(mythological_places), 3):
|
38 |
+
cols = st.columns(3)
|
39 |
+
for j in range(3):
|
40 |
+
if i + j < len(mythological_places):
|
41 |
+
with cols[j]:
|
42 |
+
if st.button(mythological_places[i + j][0]):
|
43 |
+
update_map(mythological_places[i + j])
|
44 |
+
|
45 |
+
# Display the map in Streamlit
|
46 |
+
folium_static(m)
|