使用Cartopy时出现“几何图形必须是点或线字符串错误”。

14

我正在尝试运行一个简单的Cartopy示例:

   import cartopy.crs as ccrs
   import matplotlib.pyplot as plt
   ax = plt.axes(projection=ccrs.PlateCarree())
   ax.coastlines()
   plt.show()

但我得到了这个错误:

Geometry必须是一个点(Point)或线(LineString)
python:geos_ts_c.cpp:4179: int GEOSCoordSeq_getSize_r(GEOSContextHandle_t,const geos::geom ::CoordinateSequence*,unsigned int*):Assertion`0!= cs' 失败。

我使用miniconda3安装了Cartopy:conda install -c conda-forge cartopy 我也尝试在虚拟环境中使用pip安装Cartopy,但是我遇到了相同的错误。 我的操作系统是Debian Buster。

你有什么想法吗?

1个回答

29
问题在于使用了错误版本的shapely,与Cartopy一起使用时,不应使用二进制包,而应该从源代码构建。 这在这里这里有解释。
于是我这样做了:
pip uninstall shapely
pip install shapely --no-binary shapely

谢谢!所以我的Colab命令是:!pip uninstall -y shapely !pip install shapely --no-binary shapely - Mahmut ARIKAN

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接