private final static double PI = Math.PI; // 圆周率
private final static double R = 6371.229; // 地球的半径
/**
longitude 经度
latitude 维度
*/
public double getDistance(double longt1, double lat1, double longt2,double lat2) {
double x, y, distance;
x = (longt2 - longt1)*PI*R*Math.cos(((lat1+lat2)/2)*PI/180)/180;
y = (lat2 - lat1)*PI*R/180;
distance = Math.hypot(x, y);
return distance;
}