我在使用GeoJson时遇到AttributeError。我看了医生,但找不到任何线索来解释原因。在
import folium
from folium import GeoJson
LA_COORDINATES = (34.0522, -118.2437)
zip_geo = r'zip-code-tabulation-areas-2012.geojson'
df_zip.to_json('ticket_agg.json')
df_zip.columns = ['Zipcode','Ticket_Count']
# creation of the choropleth
map1 = folium.Map(location=LA_COORDINATES, zoom_start=12)
map1.GeoJson(geo_path = zip_geo,
data_out = 'ticket_agg.json',
data = df_zip,
columns = ['Zipcode','Ticket_Count'],
key_on = 'feature.properties.external_id',
fill_color = 'YlOrRd',
fill_opacity = 0.7,
line_opacity = 0.2,
legend_name = 'Tickets per zip')
display(map1)
错误:
^{pr2}$这是指向我正在使用的geo\u json文件的链接:http://s3-us-west-2.amazonaws.com/boundaries.latimes.com/archive/1.0/boundary-set/zip-code-tabulation-areas-2012.geojson
任何建议都将不胜感激!在
显然是错误
由于
GeoJson
不是Map
类的方法而发生。在{em}我想建议最新版本的- ^{
} class 在folium版本0.7.0或更高版本中使用{a2} - 从it has been removed起没有
- GeoJSON的url是通过
} now takes a single ^{} instead of ^{}/^{}
列出变更:
data_out
选项geo_data
选项提供的,因为^{相关问题 更多 >
编程相关推荐