科研总结
1.利用Python通过经纬度计算两地实际距离 ①公式计算两点间距离(m) from math import radians, cos, sin, asin, sqrt def geodistance(lng1,lat1,lng2,lat2): #lng1,lat1,lng2,lat2 = (120.12,30.28,115.86,28.74) lng1, lat1, lng2, lat2 = map(radians, [float(lng1), float(lat1), float(lng2), float(lat2)]) #经纬度转换成弧度 dlon=lng2-lng1 dlat=lat2-lat1 a=sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 distance=2*asin(sqrt(a))*6371*1000 # 地球平均半径,6371km distance=round(distance/1000,3) return distance ②调用geopy包 from geopy.distance import geodesic print(geodesic((30.28,120.12), (28.74,115.86)).m) #计算两个坐标直线距离 print