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
评论列表
文章目录