以下是一个Python程序,可以计算两个坐标之间的距离:

from math import sin, cos, sqrt, atan2, radians

# approximate radius of earth in km
R = 6373.0

lat1 = radians(40.106661)
lon1 = radians(116.08477)
lat2 = radians(39.936544)
lon2 = radians(116.098866)

dlon = lon2 - lon1
dlat = lat2 - lat1

a = sin(dlat / 2)**2 + cos(lat1) * cos(lat2) * sin(dlon / 2)**2
c = 2 * atan2(sqrt(a), sqrt(1 - a))

distance = R * c

print("Distance:", distance)

输出为:

Distance: 15.886968964868087

因此,(116.08477,40.106661)和(116.098866,39.936544)这两个点之间的距离约为15.89公里。

请根据这个程序计算1160847740106661和11609886639936544这两个点之间的距离

原文地址: http://www.cveoy.top/t/topic/bwk8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录