Class HaversineCalculator


  • public class HaversineCalculator
    extends java.lang.Object
    Calculate the distance between 2 points on the surface on the planet. This formula uses the radius of the Earth in kilometers as 6372.8 km.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double calculate​(double lat1, double lon1, double lat2, double lon2)
      Get the distance between 2 points on the surface of the planet (in kilometers).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • calculate

        public static double calculate​(double lat1,
                                       double lon1,
                                       double lat2,
                                       double lon2)
        Get the distance between 2 points on the surface of the planet (in kilometers).
        Parameters:
        lat1 - - the latitude of the first point
        lon1 - - the longitude of the first point
        lat2 - - the latitude of the second point
        lon2 - - the longitude of the second point
        Returns:
        the distance between the 2 points