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

public interface GeoLocationService
extends EntityService<de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation>
  • Field Summary

    Fields
    Modifier and Type Field Description
    static double EARTH_RADIUS_KM  
  • Method Summary

    Static Methods
    Modifier and Type Method Description
    static double deg2dec​(int degree, int minutes, int seconds)
    Converts from degrees to decimal degrees
    static double deg2rad​(double deg)
    Converts decimal degrees to radians
    static double distance​(double latitude1, double longitude1, double latitude2, double longitude2)
    Calculates the great circle distance between two points on the Earth.
    static double distance​(double lat1, double lon1, double lat2, double lon2, java.lang.String unit)
    Calculates distance between to points.
    static java.lang.String distanceInPreferredUnit​(de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation geoLocation1, de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation geoLocation2, javax.measure.unit.Unit<javax.measure.quantity.Length> preferredUnit)  
    static double getExtremeLatitudesDiffForPoint​(de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation p1, double distance)
    Returns the difference in degrees of latitude corresponding to the distance from the center point.
    static double getExtremeLongitudesDiffForPoint​(de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation p1, double distance)
    Returns the difference in degrees of longitude corresponding to the distance from the center point.
    static de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation[] getExtremePointsFrom​(de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation centerLocation, java.lang.Double distance)
    Returns an array of two extreme points corresponding to center point and the distance from the center point.
    static double rad2deg​(double rad)
    Converts radians to decimal degrees
    static de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation validatePoint​(de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation point)
    Validates if the point passed has valid values in degrees i.e. latitude lies between -90 and +90 and the longitude

    Methods inherited from interface de.digitalcollections.cudami.server.business.api.service.identifiable.entity.EntityService

    addRelatedFileresource, addRelatedFileresource, getByRefId, getRandom, getRelatedFileResources, getRelatedFileResources, saveRelatedFileResources, saveRelatedFileResources

    Methods inherited from interface de.digitalcollections.cudami.server.business.api.service.identifiable.IdentifiableService

    cleanupLabelFromUnwantedLocales, count, delete, delete, find, find, find, findAllFull, findAllReduced, findByLanguageAndInitial, get, get, get, getByIdentifier, save, update
  • Field Details

  • Method Details

    • 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, java.lang.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 java.lang.String distanceInPreferredUnit​(de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation geoLocation1, de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation geoLocation2, javax.measure.unit.Unit<javax.measure.quantity.Length> preferredUnit)
    • getExtremeLatitudesDiffForPoint

      static double getExtremeLatitudesDiffForPoint​(de.digitalcollections.model.api.identifiable.entity.geo.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.api.identifiable.entity.geo.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.api.identifiable.entity.geo.GeoLocation[] getExtremePointsFrom​(de.digitalcollections.model.api.identifiable.entity.geo.GeoLocation centerLocation, java.lang.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.api.identifiable.entity.geo.GeoLocation validatePoint​(de.digitalcollections.model.api.identifiable.entity.geo.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