org.ka2ddo.yaac.util
Class LatLongDistance

java.lang.Object
  extended by org.ka2ddo.yaac.util.LatLongDistance

public class LatLongDistance
extends java.lang.Object

This class defines a static method that implements the WGS84 cartesian distance formula.


Constructor Summary
LatLongDistance()
           
 
Method Summary
static double computeDirection(double lat1, double long1, double lat2, double long2)
          Compute the initial compass bearing of the vector between one point and a second point, relative to True North.
static double computeDistance(double lat1, double long1, double lat2, double long2)
          Compute the distance between two points on the surface of the Earth, using the WGS84 model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LatLongDistance

public LatLongDistance()
Method Detail

computeDistance

public static double computeDistance(double lat1,
                                     double long1,
                                     double lat2,
                                     double long2)
Compute the distance between two points on the surface of the Earth, using the WGS84 model.

Parameters:
lat1 - latitude of the first point in degrees North
long1 - longitude of the first point in degrees East (negative means West)
lat2 - latitude of the second point in degrees North
long2 - longitude of the second point in degrees East (negative means West)
Returns:
distance between the points in meters

computeDirection

public static double computeDirection(double lat1,
                                      double long1,
                                      double lat2,
                                      double long2)
Compute the initial compass bearing of the vector between one point and a second point, relative to True North. This is a rectangular approximation, only good for short distances. For long distances, use OpenMap's classes for great circle and rhumb line calculations.

Parameters:
lat1 - latitude of the first point in degrees North
long1 - longitude of the first point in degrees East (negative means West)
lat2 - latitude of the second point in degrees North
long2 - longitude of the second point in degrees East (negative means West)
Returns:
compass bearing departing from first point to second point in clockwise degrees from True North