当我尝试使用Folium包映射下面的链接代码以生成坐标列表的聚集标记弹出窗口时,出现以下错误:
断言isinstance(图,图),(“您不能渲染此元素” “如果它不在图中。”
我的群集策略成功运行,没有错误。当我通过在单独的jupyter单元中实际调用地图名称来生成地图时,出现错误。我不知道解决方案。
charterdropped.crs = sdshape.crs
charterdropped = charterdropped.to_crs(epsg='4326')
cjson = charterdropped.to_json()
mappo = folium.Map([37.7556, -122.4399], zoom_start = 7)
mappo.choropleth(
geo_data=districtchanged,
data=districtchanged,
columns=['FIPS', '% Total Population: White Alone'],
key_on='feature.properties.FIPS',
legend_name='White people',
fill_color='YlGn',
fill_opacity=0.4,
highlight=True)
points = folium.features.GeoJson(cjson)
mappo.add_child(points)
#Cluster Method
marker_cluster = MarkerCluster().add_to(mappo)
for each in charterdropped[0:len(charterdropped)].iterrows():
folium.Marker(
location=[each[1]['latitude'], each[1]['longitude']],
popup=folium.Popup(
folium.IFrame(
html=each[1]['SCH_NAME'])
).add_to(marker_cluster))