-
使用說明,如何畫圖
import cartopy.crs as ccrs import matplotlib.pyplot as plt from cnmaps import get_adm_maps, draw_map jingjinji = get_adm_maps('北京市') + get_adm_maps('天津市') + get_adm_maps('河北省') fig = plt.figure(figsize=(10, 10)) ax = fig.add_subplot(111, projection=ccrs.PlateCarree()) draw_map(jingjinji, color='k') plt.show()
參考: 簡單:https://www.zhihu.com/question/267824560/answer/2345781699
詳細:https://zhajiman.github.io/post/cartopy_introduction/
http://www.360doc.com/content/22/0724/16/11604731_1041209399.shtml
氣象圖:https://www.icode9.com/content-4-846493.html -
Linux安裝
直接pip install Cartopy安裝為最新版本,需要依賴GEOS
和PROJ.4
所以安裝穩定版本 Cartopy==0.19.0.post1 一次性安裝成功
pip install Cartopy==0.19.0.post1 -i https://mirrors.aliyun.com/pypi/simple
-
win安裝
安裝依賴包 (沒有列舉的自己pip下載安裝,或下載 whl 文件安裝) https://www.lfd.uci.edu/~gohlke/pythonlibs/ 下載地址 pip install pyshp -i https://mirrors.aliyun.com/pypi/simple pip install pyproj-3.2.1-cp37-cp37m-win_amd64.whl pip install --upgrade --no-binary shapely shapely -i https://mirrors.aliyun.com/pypi/simple pip install Cartopy-0.20.2-cp37-cp37m-win_amd64.whl
參考:https://www.cnblogs.com/eroeg/p/16136437.html安裝參考 Linux win 都有 Cartopy 簡介與安裝 (gnss.help)
-
import cartopy.trace ImportError: DLL load failed: 找不到指定的模塊
shapely 包的原因 1. 先刪除 shapely 和 cartopy 包 pip uninstall shapely Cartopy -y 2. 在安裝 shapely (有網友說1.8.1(和 1.8.1.post1)導致 cartopy 崩潰。將 Shapely 降級到 1.8.0 可以解決此問題,但是我試過不行) pip install --upgrade --no-binary shapely shapely -i https://mirrors.aliyun.com/pypi/simple 3. 在安裝 cartopy pip install Cartopy-0.20.2-cp37-cp37m-win_amd64.whl
-
Could not find lib geos_c.dll or load any of its variants []
解決辦法,到安裝python的路徑上搜索 geos_c 文件 然后把 文件較大的 復制到 C:\Users\admin\AppData\Local\Programs\Python\Python37\DLLs 該路徑下 (原因就是找不到文件,那就手動找到放到它查找的目錄下)