Java Distance Calculate distanceByLBS(double lo1, double la1, double lo2, double la2)

Here you can find the source of distanceByLBS(double lo1, double la1, double lo2, double la2)

Description

distance By LBS

License

Apache License

Declaration

public static double distanceByLBS(double lo1, double la1, double lo2, double la2) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static double distanceByLBS(double lo1, double la1, double lo2, double la2) {
        double radLat1 = la1 * Math.PI / 180;
        double radLat2 = la2 * Math.PI / 180;
        double a = radLat1 - radLat2;
        double b = lo1 * Math.PI / 180 - lo2 * Math.PI / 180;
        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 * 6378137.0;//  w  w  w.  ja  va2 s. c om
        s = Math.round(s * 10000) / 10000;
        return s;
    }
}

Related

  1. distanceBetween2Points(float vectorX0, float vectorY0, float vectorXP, float vectorYP)
  2. distanceBetweenPoints(double ax, double ay, double bx, double by)
  3. DistanceBetweenPoints(double x1, double y1, double x2, double y2)
  4. distanceBetweenPoints(float vx, float vy, float wx, float wy)
  5. distanceBetweenPoints(float[] xyz1, float[] xyz2)
  6. distanceCircle(int i0, int i1, int dir, int size)
  7. distanceCorrelation(final double[][] x, final double[][] y)
  8. distanceDamerauLevenshtein(CharSequence source, CharSequence target)
  9. distanceFast(double lat1, double lon1, double lat2, double lon2)