Folium Python库中的残破的叶绿素图

时间:2018-11-06 20:26:52

标签: python-3.x folium

我正在尝试将纽约市的出租车皮卡映射到自定义的picks_zones。我的数据框包含Pickup_zones的坐标,如下所示:

{'type': 'FeatureCollection',
 'features': [{'type': 'Feature',
   'geometry': {'coordinates': [(40.4856, -74.2635),
     (40.7226, -74.2635),
     (40.4856, -74.00805),
     (40.7226, -74.00805)],
    'type': 'Polygon'},
   'properties': {'zone_id': 1}},
  {'type': 'Feature',
   'geometry': {'coordinates': [(40.4856, -74.00805),
     (40.7226, -74.00805),
     (40.4856, -73.7526),
     (40.7226, -73.7526)],
    'type': 'Polygon'},
   'properties': {'zone_id': 2}}, 

我的数据框包含每个Pickup_zone中的拾音器数量,如下所示:

     Pickup_Zone_Count  pickup_zone
211             197406          211
232             176588          232
231             167754          231
252              92810          252
253              62736          253

这是我的叶子地图的代码:

    m = folium.Map(location = [40.7589,-73.9851],zoom_start=12)
    m.choropleth(geo_data=taxi_geojson_object, data=df4,
                 columns=['pickup_zone','Pickup_Zone_Count'],
                 key_on='feature.properties.zone_id',
                 fill_color='RdYlGn', fill_opacity=0.7, line_opacity=0.8,
                 legend_name='Distribution of Incidents')
folium.LayerControl().add_to(m)

但是,结果只是一张纽约市的空白地图;区域根本没有被映射。怎么了?

Empty map of NYC

0 个答案:

没有答案