-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap3.py
More file actions
30 lines (23 loc) · 790 Bytes
/
Copy pathmap3.py
File metadata and controls
30 lines (23 loc) · 790 Bytes
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
import folium
import pandas
data = pandas.read_csv("Volcanoes.txt")
lat = list(data["LAT"])
lon = list(data["LON"])
elev = list(data["ELEV"])
def color_producer(elevation):
if elevation < 1000:
return 'green'
elif 1000 <= elevation < 3000:
return 'orange'
else:
return 'red'
html = """<h4>Volcano information:</h4>
Height: %s m
"""
map = folium.Map(location=[38.58, -99.09], zoom_start=5, tiles="Stamen Terrain")
fg = folium.FeatureGroup(name = "My Map")
for lt, ln, el in zip(lat, lon, elev):
iframe = folium.IFrame(html=html % str(el), width=200, height=100)
fg.add_child(folium.Marker(location=[lt, ln], popup=folium.Popup(iframe), icon = folium.Icon(color=color_producer(el))))
map.add_child(fg)
map.save("Map_html_popup_simple.html")