给定一个多边形列表,我试图找出所有不同的非重叠区域的边界。相交多边形的非重叠区域的边界
polygon_lst = []
for xyloc in xylocs:
polygon_lst.append(Polygon(xyloc))
这与this类似的问题。不过,我得到一个错误,当我运行unary_union操作:
from shapely.geometry import LineString
layer = polygon_lst
rings = [LineString(list(pol.exterior.coords)) for pol in layer]
from shapely.ops import unary_union, polygonize
ERROR:shapely.geos:TopologyException: found non-noded intersection between LINESTRING (103.333 327.917, 103 328) and LINESTRING (104.2 327.2, 103 328) at 103.00000000000006 328
我都试过,我创建相互重叠的顶部的所有多边形的面具一种替代方法。然后,我尝试通过Canny检测器提取不同的区域,并在opencv中找到Contour函数。然而,由这种方法产生的边界是连接的(不是每个不同区域的边界)而且是非闭合的。
会是什么,我可以去寻找这些非重叠区域及其边界的好办法?