ipyleaflet是基于leaflet的地图显示模块,提供了jupyterlab支持。ipyleaflet可进行地图动态显示,图形添加等。本人的安装环境为ubuntu18.04 + anaconda + python3.6
安装过程主要如下:
1、安装nodejs
conda install -c conda-forge nodejs=16.6.0
2、进行ipyleaflet安装
conda install -c conda-forge ipyleaflet
3、安装jupyter对应扩展
conda install -c conda-forge jupyterlab
jupyter labextension install jupyter-leaflet
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter lab build
4、检查扩展安装
jupyter labextension list
5、运行ipyleaflet示例
from ipyleaflet import Map, basemaps, basemap_to_tiles
m = Map(center=(52.204793, 360.121558), zoom=9)
dark_matter_layer = basemap_to_tiles(basemaps.CartoDB.DarkMatter)
m.add_layer(dark_matter_layer)
m
运行结果:
注意:在jupyter扩展安装中,可能会报错,需要多次运行,安装完成后,有时需要重启jupyter notebook方可成功显示效果
6、相关链接:
ipyleaflet documention:https://ipyleaflet.readthedocs.io/en/latest/installation.html