methods.py 文件源码

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

项目:WhatsMissingInGeoparsing 作者: milangritta 项目源码 文件源码
def calculate_area(info):
    """
    Calculate the area of a simple rectangle (bounding box)
    :param info - the XML string containing data
    :return: area of box
    """
    bbox = info.find("./bbox")
    if bbox is not None:
        n = bbox.find("./north").text
        s = bbox.find("./south").text
        e = bbox.find("./east").text
        w = bbox.find("./west").text
        ns = great_circle((float(n), 0.0), (float(s), 0.0)).kilometers
        ew = great_circle((0.0, float(w)), (0.0, float(e))).kilometers
        return ns * ew
    else:
        return 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号