Class GreatCircleDistance


  • public class GreatCircleDistance
    extends java.lang.Object
    Great Circle distance uses Haversine formula. There are situations where the Vincenty formula is more accurate. However, the implemented Vincenty formula has errors, see Test 'testVincentyFormula_Distance8' and 'testVincentyFormula_Distance8'.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double haversineFormula​(double lat1, double lon1, double lat2, double lon2)
      Great circle distance between Points using Haversine formula.
      static double haversineFormula​(LatLonPoint point1, LatLonPoint point2)
      Great circle distance between Lat/Lon Points using Haversine formula.
      static double haversineFormula​(org.locationtech.jts.geom.Coordinate coord1, org.locationtech.jts.geom.Coordinate coord2)
      Great circle distance between Points (x is Lon, y is Lat) using Haversine formula.
      static double haversineFormula​(org.locationtech.jts.geom.Point point1, org.locationtech.jts.geom.Point point2)
      Great circle distance between Points (x is Lon, y is Lat) using Haversine formula.
      static double vincentyFormula​(double lat1, double lon1, double lat2, double lon2)
      Great circle distance between Points using Vincenty formula.
      static double vincentyFormula​(LatLonPoint point1, LatLonPoint point2)
      Great circle distance between Lat/Lon Points using Vincenty formula.
      static double vincentyFormula​(org.locationtech.jts.geom.Coordinate coord1, org.locationtech.jts.geom.Coordinate coord2)
      Great circle distance between Points (x is Lon, y is Lat) using Vincenty formula.
      static double vincentyFormula​(org.locationtech.jts.geom.Point point1, org.locationtech.jts.geom.Point point2)
      Great circle distance between Points (x is Lon, y is Lat) using Vincenty formula.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GreatCircleDistance

        public GreatCircleDistance()
    • Method Detail

      • vincentyFormula

        public static final double vincentyFormula​(LatLonPoint point1,
                                                   LatLonPoint point2)
        Great circle distance between Lat/Lon Points using Vincenty formula.
        Parameters:
        point1 - LatLon Point in degrees.
        point2 - LatLon Point in degrees.
        Returns:
        Distance in metres.
      • vincentyFormula

        public static final double vincentyFormula​(org.locationtech.jts.geom.Point point1,
                                                   org.locationtech.jts.geom.Point point2)
        Great circle distance between Points (x is Lon, y is Lat) using Vincenty formula.
        Parameters:
        point1 - Point in degrees.
        point2 - Point in degrees.
        Returns:
        Distance in metres.
      • vincentyFormula

        public static final double vincentyFormula​(org.locationtech.jts.geom.Coordinate coord1,
                                                   org.locationtech.jts.geom.Coordinate coord2)
        Great circle distance between Points (x is Lon, y is Lat) using Vincenty formula.
        Parameters:
        coord1 - Point in degrees.
        coord2 - Point in degrees.
        Returns:
        Distance in metres.
      • vincentyFormula

        public static final double vincentyFormula​(double lat1,
                                                   double lon1,
                                                   double lat2,
                                                   double lon2)
        Great circle distance between Points using Vincenty formula.
        Parameters:
        lat1 - Lat in degrees of first point.
        lon1 - Lon in degrees of first point.
        lat2 - Lat in degrees of second point.
        lon2 - Lon in degrees of second point.
        Returns:
        Distance in metres.
      • haversineFormula

        public static final double haversineFormula​(LatLonPoint point1,
                                                    LatLonPoint point2)
        Great circle distance between Lat/Lon Points using Haversine formula.
        Parameters:
        point1 - LatLon Point in degrees.
        point2 - LatLon Point in degrees.
        Returns:
        Distance in metres.
      • haversineFormula

        public static final double haversineFormula​(org.locationtech.jts.geom.Point point1,
                                                    org.locationtech.jts.geom.Point point2)
        Great circle distance between Points (x is Lon, y is Lat) using Haversine formula.
        Parameters:
        point1 - Point in degrees.
        point2 - Point in degrees.
        Returns:
        Distance in metres.
      • haversineFormula

        public static final double haversineFormula​(org.locationtech.jts.geom.Coordinate coord1,
                                                    org.locationtech.jts.geom.Coordinate coord2)
        Great circle distance between Points (x is Lon, y is Lat) using Haversine formula.
        Parameters:
        coord1 - Point in degrees.
        coord2 - Point in degrees.
        Returns:
        Distance in metres.
      • haversineFormula

        public static final double haversineFormula​(double lat1,
                                                    double lon1,
                                                    double lat2,
                                                    double lon2)
        Great circle distance between Points using Haversine formula.
        Parameters:
        lat1 - Lat in degrees of first point.
        lon1 - Lon in degrees of first point.
        lat2 - Lat in degrees of second point.
        lon2 - Lon in degrees of second point.
        Returns:
        Distance in metres.