Package com.iizix.geo

Interface ILongitudeLatitude

  • All Known Subinterfaces:
    ILongitudeLatitudeAltitude
    All Known Implementing Classes:
    GeoLocation, RegionLocation

    public interface ILongitudeLatitude
    Interface used for geolocation with longitude and latitude.

    Programming note: DO NOT COMPARE WITH Double.NaN as e.g. value==Double.NaN, use Double.isNaN(double) instead as comparison is always false.

    Author:
    Christopher Mindus
    • Method Detail

      • getDistance

        static double getDistance​(double longitude1,
                                  double longitude2,
                                  double latitude1,
                                  double latitude2)
        Calculate distance between two points in latitude and longitude. Uses Haversine method as its base.
        Parameters:
        longitude1 - Longitude 1.
        longitude2 - Longitude 2.
        latitude1 - Latitude 1.
        latitude2 - Latitude 2.
        Returns:
        Distance in Meters, or Double.NaN if either values are Double.isNaN().
      • getLongitude

        double getLongitude()
        Gets the longitude.
        Returns:
        The longitude, or NaN if value is not present.
      • getLatitude

        double getLatitude()
        Gets the latitude.
        Returns:
        The latitude, or NaN if value is not present.
      • getDistance

        default double getDistance​(ILongitudeLatitude location)
        Gets the distance in meters between this location and another.
        Parameters:
        location - The other location.
        Returns:
        Distance in meters, Double.NaN if longitude/latitude values are not present.