GeoJSON data not displaying in Python folium map

╄→尐↘猪︶ㄣ 提交于 2019-11-29 14:48:55

That file is not a GeoJson it is a TopoJson. You need to use folium.TopoJson instead.

import folium

m = folium.Map(location=[40.66393072,-73.93827499], zoom_start=13)

folium.TopoJson(
    open('census_tracts_2010.geojson'),
    object_path='objects.nyct2010',
).add_to(m)

m

You need to open the geojson file.

    m.choropleth(open("census_tracts_2010.geojson"))

Take a look at the examples https://folium.readthedocs.io/en/latest/quickstart.html

Try this: m.add_child(folium.GeoJson(data = open("census_tracts_2010.geojson"))) and then call m.save() fun

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!