【发布时间】:2020-02-05 21:00:20
【问题描述】:
我在尝试使用 python 中的 shapely 库创建多边形时遇到问题。
[testPolygon(polygonShape) for polygonShape in fileAppender]
而testPolygon函数定义为:
def testPolygon(polygonShape):
if shapely.wkt.loads(polygonShape).is_valid:
print("great")
但我遇到了这个错误:
IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
在解析字符串对象(polygonShape)之前,是否有任何方法检查它是否是有效的多边形?或者更好的是,如果可以纠正这个损坏的多边形?
【问题讨论】:
标签: python shapefile shapely wkt