def correct_for_multipol(pol):
"""
Inputs are:
pol, Suspected Multipolygon
Takes the main polygon of a multipolygon.
Typically used to solve the problem of non-overlapping polygons being substracted.
"""
pol_type = pol.geom_type
if pol_type == 'MultiPolygon':
area = np.zeros(len(pol.geoms))
for k, p in enumerate(pol.geoms):
area[k] = p.area
max_area_id = np.argmax(area)
pol = pol.geoms[max_area_id]
return pol
评论列表
文章目录