Interface GeoLocationService

  • All Superinterfaces:
    EntityService<de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation>, IdentifiableService<de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation>
    All Known Implementing Classes:
    GeoLocationServiceImpl

    public interface GeoLocationService
    extends EntityService<de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation>
    • Method Detail

      • deg2dec

        static double deg2dec​(int degree,
                              int minutes,
                              int seconds)
        Converts from degrees to decimal degrees
        Parameters:
        degree - degrees
        minutes - minutes
        seconds - seconds
        Returns:
        decimal degrees
      • deg2rad

        static double deg2rad​(double deg)
        Converts decimal degrees to radians
        Parameters:
        deg - decimal degrees
        Returns:
        radians
      • distance

        static double distance​(double lat1,
                               double lon1,
                               double lat2,
                               double lon2,
                               String unit)
        Calculates distance between to points.

        latitude: South is negative longitude: West is negative

        Parameters:
        lat1 - latitude of point 1 (in decimal degree)
        lon1 - longitude of point 1 ( " )
        lat2 - latitude of point 2 (in decimal degree)
        lon2 - longitude of point 2 ( " )
        unit - distance unit ('M'=statute miles, 'K'=kilometers (default), 'N'=nautical miles)
        Returns:
        distance between point 1 and point 2 in given unit
      • distance

        static double distance​(double latitude1,
                               double longitude1,
                               double latitude2,
                               double longitude2)
        Calculates the great circle distance between two points on the Earth. Uses the Haversine Formula.
        Parameters:
        latitude1 - Latitude of first location in decimal degrees.
        longitude1 - Longitude of first location in decimal degrees.
        latitude2 - Latitude of second location in decimal degrees.
        longitude2 - Longitude of second location in decimal degrees.
        Returns:
        Distance in meter.
      • distanceInPreferredUnit

        static String distanceInPreferredUnit​(de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation geoLocation1,
                                              de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation geoLocation2,
                                              javax.measure.unit.Unit<javax.measure.quantity.Length> preferredUnit)
      • getExtremeLatitudesDiffForPoint

        static double getExtremeLatitudesDiffForPoint​(de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation p1,
                                                      double distance)
        Returns the difference in degrees of latitude corresponding to the distance from the center point. This distance can be used to find the extreme points.
        Parameters:
        p1 - geo point
        distance - distanc in km
        Returns:
        extreme latitudes diff in km
      • getExtremeLongitudesDiffForPoint

        static double getExtremeLongitudesDiffForPoint​(de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation p1,
                                                       double distance)
        Returns the difference in degrees of longitude corresponding to the distance from the center point. This distance can be used to find the extreme points.
        Parameters:
        p1 - geo point
        distance - distance in km
        Returns:
        extreme longitudes diff in km
      • getExtremePointsFrom

        static de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation[] getExtremePointsFrom​(de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation centerLocation,
                                                                                                               Double distance)
        Returns an array of two extreme points corresponding to center point and the distance from the center point. These extreme points are the points with min latitude and longitude and max latitude and longitude.
        Parameters:
        centerLocation - location in latitude/longitude
        distance - distance radius [km]
        Returns:
        minimum (first) and maximum (second) points
      • rad2deg

        static double rad2deg​(double rad)
        Converts radians to decimal degrees
        Parameters:
        rad - radians
        Returns:
        decimal degrees
      • validatePoint

        static de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation validatePoint​(de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation point)
        Validates if the point passed has valid values in degrees i.e. latitude lies between -90 and +90 and the longitude
        Parameters:
        point - geo location
        Returns:
        corrected geolocation