问题描述
我目前使用的是 0.12.1 版本的 folium 和 python 3.8.3。
执行以下代码后出现 Cannot render objects with any missing geometries: <_io.TextIOWrapper name='world.json' mode='r' encoding='cp1251'>
错误。
import folium
import pandas
data = pandas.read_csv('Volcanoes.txt')
lat = list(data["LAT"])
lon = list(data["LON"])
elev = list(data["ELEV"])
def dynamic_colors(el):
if el < 2000:
color = 'green'
elif el >=2000 and el <3000:
color = 'orange'
else:
color = 'red'
return color
map = folium.Map(location=[lat[0],lon[0]],zoom_start=5,tiles="Stamen Terrain")
fg = folium.FeatureGroup(name="My Map")
for lt,ln,el in zip(lat,lon,elev):
fg.add_child(folium.CircleMarker(location=[lt,ln],popup=folium.Popup(str(el) + ' m',parse_html=True),fill_color=dynamic_colors(el),color='grey',fill_opacity=0.7))
data = open('world.json','r')
fg.add_child(folium.GeoJson(data))
map.add_child(fg)
map.save("Map1.html")
导致错误的行是
data = open('world.json','r')
fg.add_child(folium.GeoJson(data))
我该如何解决这个问题
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)