【发布时间】:2020-10-23 04:01:37
【问题描述】:
我的 Choropleth 地图有这些奇怪的黑点,我不确定它是否缺少数据。我该如何去除这些黑点?
我的 csv:https://drive.google.com/file/d/10FULaQ7f4lfWdPpk4bzwlD9yymGrL14d/view?usp=sharing
我的 GeoJson:https://drive.google.com/file/d/1GZljNjbIXsx55xopN9_DDlOb0Pi9Eclz/view?usp=sharing
我在 Jupyter 上运行它:
# CHOROPLETH MAP
import json
kunnat_geo = r'kuntarajat.geojson'
with open(kunnat_geo) as kunnat_file:
kunnat_json = json.load(kunnat_file,encoding='utf8')
type(kunnat_json)
df = pd.read_csv('cleandata.csv')
map = folium.Map(location=[65,26], zoom_start=4, tiles='openstreetmap')
map.choropleth(geo_data=kunnat_geo,
data=df, # my dataset
columns=['Kunta', 'data'],
key_on='feature.properties.Name',
fill_color='OrRd', fill_opacity=0.7, line_opacity=0.2,
legend_name='Mielenterveyden kuntoutuskotien asiakkaat vuonna 2018',
smooth_factor=0)
marker_cluster = MarkerCluster().add_to(map)
for i in range(0,len(coords)):
folium.Marker([coords.iloc[i]['lat'], coords.iloc[i]['lng']], popup=coords.iloc[i]['data'],tooltip='Mielenterveyden kuntoutuskotien asiakkaat vuonna 2018').add_to(marker_cluster)
coords.head()
map.save('Choropleth.html')
map
编辑:解决了这个问题。 Folium 无法显示北欧字母 Ä、Ö 或 Å。不得不从我的数据中删除它们,现在它可以工作了。
【问题讨论】:
-
我们来了。
kunnat_geo是什么?您似乎没有在发布的代码中使用它。此外,运行您的代码我没有在您发布的图像中得到结果。你可以检查一下代码和你说要得到的结果之间的对应关系吗?谢谢。 -
我更新了代码,但没有结果。
-
让我们检查一些地区。顶部黑色区域的名称是什么?
-
如何检查它们?因为当我点击这些区域时什么都没有弹出。
-
知道名字吗?
标签: python python-3.x geojson folium choropleth