python - 未找到 Shapely parallel_offset

标签 python attributeerror shapely

我正在尝试使用 Shapely parallel_offset,但似乎没有找到它。我已包含示例中找到的导入,但它无法识别 parallel_offset

from matplotlib import pyplot
from shapely.geometry import LineString
from descartes import PolygonPatch

line=LineString([(0,0),(0,1),(1,1),(2,0)])
offset = line.parallel_offset(1,'left',join_style=2)

我得到:

$ python parallel_offset.py 
Traceback (most recent call last):
  File "parallel_offset.py", line 6, in <module>
    offset = line.parallel_offset(1,'left',join_style=2)
AttributeError: 'LineString' object has no attribute 'parallel_offset'

我做错了什么?

最佳答案

此功能有两个需要满足的要求:

  • 身材匀称 >= 1.2.8
  • GEOS >= 3.2.0

关于python - 未找到 Shapely parallel_offset,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15161821/

相关文章:

python - Pickle: AttributeError: 'module' 对象没有属性

python - 如何在形状优美的Python中在具有多边形的多边形上打洞

python - 将几何列转换为 Geodataframe 中的经纬度列

python - Seaborn Facetgrid x 轴不正确

python - TensorFlow - 'split_dim' Op 的输入 'Split' 的 float32 类型与预期的 int32 类型不匹配

python - “队列”对象没有属性 'size'

python - 使用 Shapely 寻找一种快速查找点所属多边形的方法

python - Tensorflow:在不运行任何 session 的情况下将 Tensor 转换为 numpy 数组

python - 在 anaconda 上安装 cx_freeze?

python - 以我自己的观点使用 Django Admin 搜索引擎