叶绿素图还没有任何输出

2024-06-23 19:08:10 发布

您现在位置:Python中文网/ 问答频道 /正文

Geojson文件可用: 下面的代码没有显示任何结果,有什么问题吗

!wget --quiet https://cocl.us/sanfran_geojson -O san_francisco_nh.json

print('GeoJSON file downloaded!')
sanfran_map.choropleth(
    geo_data=sanfran_geo,
    data=df_sf,
    columns=['Neighborhood', 'Count'],
    key_on='feature.properties.DISTRICT',
    fill_color='YlOrRd', 
    fill_opacity=0.7, 
    line_opacity=0.2,
    legend_name="Crime Rate in San Francisco"
)

Tags: 文件代码httpsdatageojsonwgetfillgeo
1条回答
网友
1楼 · 发布于 2024-06-23 19:08:10

使用folium.Choroplethfolium.LayerControl

import folium

m = folium.Map(location=[37.773972, -122.43],
               zoom_start=10,
               control_scale=True)

folium.Choropleth(geo_data=sanfran_geo,
                  name='choropleth',
                  data=df_sf,
                  columns=['Neighborhood', 'Count'],
                  key_on='feature.properties.DISTRICT',
                  fill_color='YlOrRd',
                  fill_opacity=0.7,
                  line_opacity=0.2,
                  legend_name='Crime Rate in San Francisco').add_to(m)

folium.LayerControl().add_to(m)

m

相关问题 更多 >

    热门问题