Class HaversineCalculator

java.lang.Object
de.hybris.platform.warehousing.sourcing.context.util.HaversineCalculator

public class HaversineCalculator extends 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 Details

    • 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