我正在尝试使用 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'
我究竟做错了什么?