Link to home
Start Free TrialLog in
Avatar of chalie001
chalie001

asked on

error in python

hi am having the following error
python mapView.py

  File "mapView.py", line 33

    map.add_child(fg)

      ^

SyntaxError: invalid syntax

code is
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(elevetion):
    if elevetion < 1000:
        return  'green'
    elif 1000 <= elevetion < 3000:
        return 'orange'
    else:
        return 'red'	
 
 
#map = folium.Map(location=[lat, lon], zoom_start=6, tiles="Stamen Terrain")
map = folium.Map(location=[lat[0], lon[0]], zoom_start=5, tiles="Stamen Terrain")
#map = folium.Map(location=[0, 0], zoom_start=6)
 
 
 
fg = folium.FeatureGroup(name="My Map")
 
for lt,ln,el in zip(lat,lon,elev):
     fg.add_child(folium.Marker(location=[lt, ln],popup=str(el)+" m",icon=folium.Icon(color=color_producer(el)))
	
map.add_child(fg)
 
map.save("map092.html")	

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial