在处理GPS数据时,经常会给出两点的距离,来计算两点之间的距离,这个距离大致可看作直线距离,python版本代码如下所示:
from math import radians, cos, sin, asin, sqrt
def get_distance(lon1, lat1, lon2, lat2):
"""
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
"""