awacke1 commited on
Commit
1374e9a
1 Parent(s): 2fc65e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py CHANGED
@@ -1,6 +1,7 @@
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 = [
@@ -19,6 +20,30 @@ mythological_places = [
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(
 
1
  import streamlit as st
2
  import folium
3
  from streamlit_folium import folium_static
4
+ from folium.plugins import MarkerCluster, PolyLine # add MarkerClusers
5
 
6
  # Define mythological places data for Iceland
7
  mythological_places = [
 
20
  # Create a map centered on Iceland
21
  m = folium.Map(location=[65.0, -18.0], zoom_start=7)
22
 
23
+ # Add markers for each mythological place and add them to a MarkerCluster
24
+ marker_cluster = MarkerCluster().add_to(m)
25
+ for place in mythological_places:
26
+ folium.Marker(
27
+ location=[place[1], place[2]],
28
+ popup=f'<b>{place[0]}</b><br>{place[3]}',
29
+ icon=folium.Icon(color='red')
30
+ ).add_to(marker_cluster)
31
+
32
+ # Add PolyLine for paths between markers with animation
33
+ locations = [place[1:3] for place in mythological_places]
34
+ path = PolyLine(locations, color='blue', opacity=0.8, weight=5, smooth_factor=0.5).add_to(m)
35
+ path.add_child(folium.plugins.PolyLineTextPath(text='\u25BA', repeat=True, offset=6, attributes={'fill': 'blue', 'font-weight': 'bold', 'font-size': '12'}))
36
+
37
+ folium_static(m)
38
+
39
+ st.markdown("""
40
+ # Icelandic Mythological Places
41
+
42
+ The map above shows the location of various mythological places in Iceland. Hover over the markers to learn more about the stories behind each location.
43
+
44
+ """)
45
+
46
+
47
  # Add markers for each mythological place
48
  for place in mythological_places:
49
  folium.Marker(