public class DistanceCalculationHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright notice field.
|
Modifier and Type | Method and Description |
---|---|
static double |
convertDoubleKilometersToMiles(double anKilometerValue)
Returns the miles equivalent of the kilometer value
|
static double |
convertDoubleMilesToKilometers(double aMileValue)
Returns the kilometer equivalent of the mile value
|
static float |
convertFloatKilometersToMiles(float anKilometerValue)
Returns the miles equivalent of the kilometer value
|
static float |
convertfloatMilesToKilometers(float aMileValue)
Returns the kilometer equivalent of the mile value
|
static double |
degreesToRadians(double anDegrees)
Converts a numeric representation of degrees to its equivalent in radians.
|
static double |
getDistanceBetweenGeoCodes(PhysicalStoreGeoCodeType aGeoCode1,
PhysicalStoreGeoCodeType aGeoCode2)
Returns the distance between the two geographical codes in kilometers
Based on the great circle distance formula variant:
distance(lat1, long1, lat2, long2) = 2R*sin^-1(sqrt(sin^2((lat1-lat2)/2) + (cos(lat1)*cos(lat2)*sin^2((long1-long2)/2))))
Where all latitudes and longitudes are assumed to be radians. |
static PhysicalStoreGeoCodeType |
getNorthWestGeoCode(PhysicalStoreGeoCodeType aCenterGeoCode,
double anRadius)
Gets the north-west boundary of the range of geographical codes to search
|
static PhysicalStoreGeoCodeType |
getSouthEastGeoCode(PhysicalStoreGeoCodeType aCenterGeoCode,
double anRadius)
Gets the south-east boundary of the range of geographical codes to search
|
static double |
radiansToDegrees(double anRadians)
Converts a numeric representation of radians to its equivalent in degrees.
|
public static final java.lang.String COPYRIGHT
public static double getDistanceBetweenGeoCodes(PhysicalStoreGeoCodeType aGeoCode1, PhysicalStoreGeoCodeType aGeoCode2)
distance(lat1, long1, lat2, long2) = 2R*sin^-1(sqrt(sin^2((lat1-lat2)/2) + (cos(lat1)*cos(lat2)*sin^2((long1-long2)/2))))
Where all latitudes and longitudes are assumed to be radians.
this method will convert geographical codes from degrees to radians.
Also, R = Approximate Earth radiusaGeoCode1
- The first geographical code.aGeoCode2
- The second geographical code.public static double convertDoubleKilometersToMiles(double anKilometerValue)
anKilometerValue
- the double kilometer value.public static double convertDoubleMilesToKilometers(double aMileValue)
aMileValue
- the double mile value.public static float convertFloatKilometersToMiles(float anKilometerValue)
anKilometerValue
- the float kilometer value.public static float convertfloatMilesToKilometers(float aMileValue)
aMileValue
- the float mile value.public static PhysicalStoreGeoCodeType getNorthWestGeoCode(PhysicalStoreGeoCodeType aCenterGeoCode, double anRadius)
aCenterGeoCode
- the center pointanRadius
- the distance from the center in kilometerspublic static PhysicalStoreGeoCodeType getSouthEastGeoCode(PhysicalStoreGeoCodeType aCenterGeoCode, double anRadius)
aCenterGeoCode
- the center pointanRadius
- the distance from the centerpublic static double degreesToRadians(double anDegrees)
anDegrees
- - value in degreespublic static double radiansToDegrees(double anRadians)
anRadians
- - value in radians