I tried to render a map with folium in a python script. When I put the rendering in a for statement, no map renders. Below are two scripts. One works, one does not. The only difference is the placement of the m1 object to render the map. Can anyone indicate what the issue is? Is it sometype of scoping issue?
Thanks.
Al
#works
import folium
lat1=[42.3601]
lon1=[-71.0589]
for i in range(1):
m1 = folium.Map(location=[lat1[0],lon1[0]],zoom_start=14)
for j in range(len(lat1)):
folium.Marker(location=[lat1[j],lon1[j]],
icon= folium.Icon(color='green')
).add_to(m1)
m1
#does not work moved the m1 statement in the first for statement
import folium
lat1=[42.3601]
lon1=[-71.0589]
for i in range(1):
m1 = folium.Map(location=[lat1[0],lon1[0]],zoom_start=14)
for j in range(len(lat1)):
folium.Marker(location=[lat1[j],lon1[j]],
icon= folium.Icon(color='green')
).add_to(m1)
m1