更新时间:2021-09-18 23:36:47
请参见大圆圈距离
double CoordDistance(double latitude1, double longitude1, double latitude2, double longitude2)
{
return 6371 * Math.acos(
Math.sin(latitude1) * Math.sin(latitude2)
+ Math.cos(latitude1) * Math.cos(latitude2) * Math.cos(longitude2 - longitude1));
}
如果您的经度和纬度以度为单位,则将它们转换为弧度.
If your latitude and longitude are in degrees convert them to radians.