utilities.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:stcad 作者: feschmidt 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号