5
根据纬度/经度获取两点之间的距离
我尝试实现此公式:http ://andrew.hedges.name/experiments/haversine/ aplet可以很好地满足我测试的两点要求: 但是我的代码无法正常工作。 from math import sin, cos, sqrt, atan2 R = 6373.0 lat1 = 52.2296756 lon1 = 21.0122287 lat2 = 52.406374 lon2 = 16.9251681 dlon = lon2 - lon1 dlat = lat2 - lat1 a = (sin(dlat/2))**2 + cos(lat1) * cos(lat2) * (sin(dlon/2))**2 c = 2 * atan2(sqrt(a), …