python - 在 jupyter 中带有 Folium 的 Python 映射错误
问题描述
我正在尝试将地图导入 jupyter,但它不希望任何工作。我在 .csv 中有两列,称为
df[['latitude', 'longitude']]
df.head(20)
到目前为止一切都很好
当我尝试表示它时(我已经做了很多尝试)或者它给了我空白,或者在等待大约 10 分钟后我必须重新启动 jupyter,因为它阻塞了。我声明我有大约 65000 行经纬度,我使用的代码是这样的:
m = folium.Map([41.4, 12.7], zoom_start=8)
m
我正确地看到了地图
for index, row in df.iterrows():
folium.Marker([row['latitude'], row['longitude']],
#popup=row['Location'],
icon=folium.Icon(icon='cloud')
).add_to(m)
m
我得到了我上面描述的问题....感谢那些可以帮助我的人
解决方案
尝试使用FastMarkerCluster
.
import folium
from folium import plugins
locations = []
for index, row in df.iterrows():
locations.append([row['latitude'], row['longitude'])
marker_cluster = plugins.FastMarkerCluster(locations).add_to(m)
m
现在您的点首先被聚集在一起,如果您放大单个位置将是可见的。
推荐阅读
- python - 如何使用此时间序列数据进行作物预测?
- javascript - addEventListener("change" ... 用于改变 innerHTML 的输入工程的值上升但不下降
- powerbi - 如何设置 Power BI 许可证
- javascript - 访问复杂 javascript 对象的元素
- python - 是否有更有效的方法来迭代矩阵并在特定列上执行计算?
- html - 向下滚动时,如何使它与我的视频重叠?
- sql - 为什么在 Postgres 中查询 LTREE 时字符串连接不起作用?
- grails - grails 4 sessionRegistry为空
- java - 从实现 Queue 接口的 ListQueue 类调用受保护的方法“Front”
- java - 如何修复“找不到引用的类 com.google.protobuf”?