计算GPS点之间的距离
latitude纬度 longtitude经度 // 求弧度 double getRadian(double d) { return d * PI / 180.0; //角度1? = π / 180 } //计算距离 米 double getDistance(double lat1, double lng1, double lat2, double lng2) { double radLat1 = getRadian(lat1); double radLat2 = getRadian(lat2); double a = radLat1 - radLat2; double b = getRadian(lng1) - getRadian(lng2); double dst = 2 * asin((sqrt(pow(sin(a / 2), 2) + cos(radLat1) * cos(radLat2) * pow(sin(b / 2), 2) ))); dst = dst * EARTH_RADIUS * 1000; return dst; }