Class WGS84Util


  • public class WGS84Util
    extends Object
    Some utility methods for WGS84 points. Note that all calculations are being made by assuming a spherical shape of the earth (not elliptic). The EARTH_MEAN_RADIUS is used as radius.
    • Constructor Detail

      • WGS84Util

        public WGS84Util()
    • Method Detail

      • shortestDistanceBetween

        public static double shortestDistanceBetween​(org.locationtech.jts.geom.Point a,
                                                     org.locationtech.jts.geom.Point b)
        Calculates the shortest distance between two points on a great circle.
        Parameters:
        a - a point.
        b - another point.
        Returns:
        the shortest distance between point A and point B.
      • getLongitudeDelta

        public static double getLongitudeDelta​(double latitude,
                                               double distance)
        Calculates the longitude delta for a given distance.
        Parameters:
        latitude - the latitude in radians to calculate the distance delta from.
        distance - the distance in kilometer.
        Returns:
        the longitude delta in degrees.
      • getLatitudeDelta

        public static double getLatitudeDelta​(double distance)
        Calculates the latitude delta from a point from a given distance.
        Parameters:
        distance - the distance in kilometer.
        Returns:
        the latitude delta in degrees.
      • getLatitutesCircleRadius

        static double getLatitutesCircleRadius​(double latitude)
        Parameters:
        latitude - in degrees in radians.
        Returns:
        the length of the latitude radius.
      • normalizeLongitude

        public static double normalizeLongitude​(double longitude)
        Normalizes given longitude to bounds [-180.0,180.0].
        Parameters:
        longitude - in degrees.
        Returns:
        the normalized longitude.
      • normalizeLatitude

        public static double normalizeLatitude​(double latitude)
        Normalizes given latitude to bounds [-90.0,90.0].
        Parameters:
        latitude - in degrees.
        Returns:
        the normalized latitude.