AttributeError: ‘MultiPolygon‘ object has no attribute ‘exterior‘
使用shapely库爆出的错误。
看poly的类型,类型不一样,解决方案也不一样
if (poly.geom_type == 'MultiPolygon'):
# if MultiPolygon, take the smallest convex Polygon containing all the points in the object
poly = poly.convex_hull
if (poly.geom_type == 'Polygon'): # Ignore if still not a Polygon (could be a line or point)
polygons.append(poly)
segmentation = np.array(poly.exterior.coords).ravel().tolist()
segmentations.append(segmentation)
本文来自博客园,作者:赫凯,转载请注明原文链接:https://www.cnblogs.com/heKaiii/p/17137349.html