Geometry must be a Point or LineString error using Cartopy

旧巷老猫 提交于 2020-06-14 06:44:26

问题


I'm trying to run a simple Cartopy example:

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

But I'm getting this error:

Geometry must be a Point or LineString
python: geos_ts_c.cpp:4179: int GEOSCoordSeq_getSize_r(GEOSContextHandle_t, const geos::geom::CoordinateSequence*, unsigned int*): Assertion0 != cs' failed`.

I installed Cartopy using miniconda3: conda install -c conda-forge cartopy I also tried to install Cartopy with pip (in a virtual environment), but I get the same error. My OS is Debian Buster.

Any idea?


回答1:


The problem is a wrong version of shapely, with Cartopy the binary package shoudn't be used, it should be built from source instead. This is explained here and here.

So I did:

pip uninstall shapely
pip install shapely --no-binary shapely


来源:https://stackoverflow.com/questions/60111684/geometry-must-be-a-point-or-linestring-error-using-cartopy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!