Interface GeoLocationService<G extends de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation>
- All Superinterfaces:
EntityService<G>,IdentifiableService<G>,UniqueObjectService<G>
- All Known Subinterfaces:
CanyonService,CaveService,ContinentService,CountryService,CreekService,HumanSettlementService,LakeService,MountainService,OceanService,RiverService,SeaService,StillWatersService,ValleyService
- All Known Implementing Classes:
CanyonServiceImpl,CaveServiceImpl,ContinentServiceImpl,CountryServiceImpl,CreekServiceImpl,GeoLocationServiceImpl,HumanSettlementServiceImpl,LakeServiceImpl,MountainServiceImpl,OceanServiceImpl,RiverServiceImpl,SeaServiceImpl,StillWatersServiceImpl,ValleyServiceImpl
public interface GeoLocationService<G extends de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation>
extends EntityService<G>
-
Field Summary
Fields -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic doubledeg2dec(int degree, int minutes, int seconds) Converts from degrees to decimal degreesstatic doubledeg2rad(double deg) Converts decimal degrees to radiansstatic doubledistance(double latitude1, double longitude1, double latitude2, double longitude2) Calculates the great circle distance between two points on the Earth.static doubleCalculates distance between to points.static StringdistanceInPreferredUnit(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) static doublegetExtremeLatitudesDiffForPoint(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.static doublegetExtremeLongitudesDiffForPoint(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.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.static doublerad2deg(double rad) Converts radians to decimal degreesstatic de.digitalcollections.model.identifiable.entity.geo.location.GeoLocationvalidatePoint(de.digitalcollections.model.identifiable.entity.geo.location.GeoLocation point) Validates if the point passed has valid values in degrees i.e.Methods inherited from interface de.digitalcollections.cudami.server.business.api.service.identifiable.entity.EntityService
getByRefIdMethods inherited from interface de.digitalcollections.cudami.server.business.api.service.identifiable.IdentifiableService
addRelatedEntity, addRelatedFileresource, cleanupLabelFromUnwantedLocales, findByLanguageAndInitial, findRelatedEntities, findRelatedFileResources, getByExampleAndLocale, getByIdentifier, getLanguages, setRelatedEntities, setRelatedFileResources, validateMethods inherited from interface de.digitalcollections.cudami.server.business.api.service.UniqueObjectService
count, create, delete, delete, find, getAll, getByExample, getByExamples, getByExamplesAndFiltering, getRandom, save, update
-
Field Details
-
EARTH_RADIUS_KM
static final double EARTH_RADIUS_KM- See Also:
-
-
Method Details
-
deg2dec
static double deg2dec(int degree, int minutes, int seconds) Converts from degrees to decimal degrees- Parameters:
degree- degreesminutes- minutesseconds- 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 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.
-
distance
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
-
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 pointdistance- 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 pointdistance- 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/longitudedistance- 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
-