正在显示时钟,但背景图只是灰色。在Jupyter中使用叶面0.10.0
显然以前曾经有一个_build_map()函数来执行此操作,该函数已从folium和folium中删除.Map()似乎对某些人有效,但就我而言不是。 我还尝试了.display(Map),但没有任何结果。
SF_map = folium.Map(location=SF_coordinates, tiles='Mapbox Bright', zoom_start=12)
display(SF_map)
folium.Choropleth(
geo_data=SF_geo,
name='Choropleth',
data=df_incidents,
columns=['Neighborhood', 'Count'],
key_on='properties.DISTRICT',
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Crime Incidents by Neighborhood'
).add_to(SF_map)
folium.LayerControl().add_to(SF_map)
SF_map
我希望可见地图的顶部有一个胆管层,但是它的胆管层是灰色的。当在添加圆度之前单独调用地图时,+和-缩放按钮会出现,并且一旦您达到缩放的极限,似乎就会起作用,但是它全是灰色的。没有错误消息返回。
答案 0 :(得分:0)
由于无法加载图块,最有可能的地图没有出现(显示为灰色),在这种情况下,控制台中显示以下错误:
即使在叶子中Mapbox Bright
是listed among default tilesets:
- "OpenStreetMap"
- "Mapbox Bright" (Limited levels of zoom for free tiles)
- "Mapbox Control Room" (Limited levels of zoom for free tiles)
- "Stamen" (Terrain, Toner, and Watercolor)
- "Cloudmade" (Must pass API key)
- "Mapbox" (Must pass API key)
- "CartoDB" (positron and dark_matter)
似乎Mapbox Bright
个图块不再可用(类似的问题has been reported here)
切换到OpenStreetMap
个图块时:
coordinates = [37.7577627,-122.4726194]
map = folium.Map(location=coordinates, tiles='OpenStreetMap', zoom_start=12)
folium.Choropleth(
geo_data='https://cocl.us/sanfran_geojson' ,
name='choropleth',
data=df_incidents,
columns = ['PdDistrict','IncidntNum'],
key_on='feature.properties.DISTRICT',
fill_color='YlOrRd',
fill_opacity=0.6,
line_opacity=0.2,
legend_name='Crime in San Francisco'
).add_to(map)
map
choroppleth图层以及地图将按预期显示: