## Class DistanceCalculationHelper

• java.lang.Object

• ```public class DistanceCalculationHelper
extends java.lang.Object```
A helper class performs the distance calculations between GeoCodes. Uses the Great Circle Formula to determine distances between points on the Earth. All distance calculations assume kilometers, to convert between miles and kilometers, use the convertKilometersToMiles method.
• ### Field Summary

Fields
Modifier and Type Field and Description
`static java.lang.String` `COPYRIGHT`
• ### Method Summary

All Methods
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.
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

`public static final java.lang.String COPYRIGHT`
Constant Field Values
• ### Method Detail

• #### getDistanceBetweenGeoCodes

```public 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. this method will convert geographical codes from degrees to radians. Also, R = Approximate Earth radius
Parameters:
`aGeoCode1` - The first geographical code.
`aGeoCode2` - The second geographical code.
Returns:
the distance.
• #### convertDoubleKilometersToMiles

`public static double convertDoubleKilometersToMiles(double anKilometerValue)`
Returns the miles equivalent of the kilometer value
Parameters:
`anKilometerValue` - the double kilometer value.
Returns:
the double mile value.
• #### convertDoubleMilesToKilometers

`public static double convertDoubleMilesToKilometers(double aMileValue)`
Returns the kilometer equivalent of the mile value
Parameters:
`aMileValue` - the double mile value.
Returns:
the double kilometer value.
• #### convertFloatKilometersToMiles

`public static float convertFloatKilometersToMiles(float anKilometerValue)`
Returns the miles equivalent of the kilometer value
Parameters:
`anKilometerValue` - the float kilometer value.
Returns:
the float mile value.
• #### convertfloatMilesToKilometers

`public static float convertfloatMilesToKilometers(float aMileValue)`
Returns the kilometer equivalent of the mile value
Parameters:
`aMileValue` - the float mile value.
Returns:
the float kilometer value.
• #### getNorthWestGeoCode

```public static PhysicalStoreGeoCodeType getNorthWestGeoCode(PhysicalStoreGeoCodeType aCenterGeoCode,
Gets the north-west boundary of the range of geographical codes to search
Parameters:
`aCenterGeoCode` - the center point
`anRadius` - the distance from the center in kilometers
Returns:
the geographical code of GeoCodeType object.
• #### getSouthEastGeoCode

```public static PhysicalStoreGeoCodeType getSouthEastGeoCode(PhysicalStoreGeoCodeType aCenterGeoCode,
Gets the south-east boundary of the range of geographical codes to search
Parameters:
`aCenterGeoCode` - the center point
`anRadius` - the distance from the center
Returns:
the geographical code of GeoCodeType object.

`public static double degreesToRadians(double anDegrees)`
Converts a numeric representation of degrees to its equivalent in radians.
Parameters:
`anDegrees` - - value in degrees
Returns:
`public static double radiansToDegrees(double anRadians)`
`anRadians` - - value in radians