public static double Calc(double Lat1,
double Long1, double Lat2, double Long2)
{
double dDistance = 0;
double dLat1InRad = Lat1 * (Math.PI / 180.0);
double dLong1InRad = Long1 * (Math.PI / 180.0);
double dLat2InRad = Lat2 * (Math.PI / 180.0);
double dLong2InRad = Long2 * (Math.PI / 180.0);
double dLongitude = dLong2InRad - dLong1InRad;
double dLatitude = dLat2InRad - dLat1InRad;
double a = Math.pow(Math.sin(dLatitude / 2.0), 2.0) +
Math.cos(dLat1InRad) * Math.cos(dLat2InRad) *
Math.pow(Math.sin(dLongitude / 2.0), 2.0);
double c = 2.0 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0 - a));
double kEarthRadiusKms = 6376.5;
dDistance = kEarthRadiusKms * c;
return dDistance;
}
인터넷을 찾다가 어느분 블로그에서 본 소슨데 안드로이드에 적용했당~
-_-출처를 적을려고했떠니...그사이트가 어딘지 기억이 안나네요 ㅠ 무튼 감사합니당!