GPS 经纬度两点距离【转】
作者:互联网
// 由经纬度计算两点距离
private final double EARTH_RADIUS = 6378137.0;
private double gps2m(double lat_a, double lng_a, double lat_b, double lng_b) {
double radLat1 = (lat_a * Math.PI / 180.0);
double radLat2 = (lat_b * Math.PI / 180.0);
double a = radLat1 - radLat2;
double b = (lng_a - lng_b) * Math.PI / 180.0;
double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
+ Math.cos(radLat1) * Math.cos(radLat2)
* Math.pow(Math.sin(b / 2), 2)));
s = s * EARTH_RADIUS;
s = Math.Round(s * 10000) / 10000;
return s;
}
转载于:https://www.cnblogs.com/heimi/archive/2013/01/15/2860918.html
标签:180.0,经纬度,double,两点,lat,lng,PI,Math,GPS 来源: https://blog.csdn.net/weixin_34320159/article/details/94565789