org.dinopolis.gpstool.util
Class GeoMath

java.lang.Object
  extended byorg.dinopolis.gpstool.util.GeoMath

public class GeoMath
extends java.lang.Object

This class provides some calculations for latitude/longitude. The formulas are taken from http://williams.best.vwh.net/avform.html Beware that on the web page, negative longitude indicates west!

Version:
$Revision: 1.6 $
Author:
Christof Dallermassl

Field Summary
static double CIRCUMFERENCE_EQUATOR
           
static double M_PER_DEGREE
           
static double M_PER_RADIAN
           
static double RADIUS_EQUATOR
           
 
Constructor Summary
GeoMath()
           
 
Method Summary
static double courseDegrees(double latitude1, double longitude1, double latitude2, double longitude2)
          Calculates the course between two points.
static double courseRadians(double latitude1, double longitude1, double latitude2, double longitude2)
          Calculates the course between two points.
static double distance(double latitude1, double longitude1, double latitude2, double longitude2)
          Calculates the distance between two points.
static double distanceDegrees(double latitude1, double longitude1, double latitude2, double longitude2)
          Calculates the distance between two points.
static double distanceRadians(double latitude1, double longitude1, double latitude2, double longitude2)
          Calculates the distance between two points.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RADIUS_EQUATOR

public static final double RADIUS_EQUATOR
See Also:
Constant Field Values

CIRCUMFERENCE_EQUATOR

public static final double CIRCUMFERENCE_EQUATOR
See Also:
Constant Field Values

M_PER_DEGREE

public static final double M_PER_DEGREE
See Also:
Constant Field Values

M_PER_RADIAN

public static final double M_PER_RADIAN
See Also:
Constant Field Values
Constructor Detail

GeoMath

public GeoMath()
Method Detail

distance

public static double distance(double latitude1,
                              double longitude1,
                              double latitude2,
                              double longitude2)
Calculates the distance between two points.

Parameters:
latitude1 - the latitude of the first point given in degrees.
longitude1 - the longitude of the first point given in degrees.
latitude2 - the latitude of the second point given in degrees.
longitude2 - the longitude of the second point given in degrees.
Returns:
the distance in meters.

distanceDegrees

public static double distanceDegrees(double latitude1,
                                     double longitude1,
                                     double latitude2,
                                     double longitude2)
Calculates the distance between two points.

Parameters:
latitude1 - the latitude of the first point given in degrees.
longitude1 - the longitude of the first point given in degrees.
latitude2 - the latitude of the second point given in degrees.
longitude2 - the longitude of the second point given in degrees.
Returns:
the distance in degrees.

distanceRadians

public static double distanceRadians(double latitude1,
                                     double longitude1,
                                     double latitude2,
                                     double longitude2)
Calculates the distance between two points.

Parameters:
latitude1 - the latitude of the first point given in radians.
longitude1 - the longitude of the first point given in radians.
latitude2 - the latitude of the second point given in radians.
longitude2 - the longitude of the second point given in radians.
Returns:
the distance in radians.

courseDegrees

public static double courseDegrees(double latitude1,
                                   double longitude1,
                                   double latitude2,
                                   double longitude2)
Calculates the course between two points.

Parameters:
latitude1 - the latitude of the first point given in degrees.
longitude1 - the longitude of the first point given in degrees.
latitude2 - the latitude of the second point given in degrees.
longitude2 - the longitude of the second point given in degrees.
Returns:
the course in degrees [0,360].

courseRadians

public static double courseRadians(double latitude1,
                                   double longitude1,
                                   double latitude2,
                                   double longitude2)
Calculates the course between two points.

Parameters:
latitude1 - the latitude of the first point given in radians.
longitude1 - the longitude of the first point given in radians.
latitude2 - the latitude of the second point given in radians.
longitude2 - the longitude of the second point given in radians.
Returns:
the course in radians (-pi,pi).

main

public static void main(java.lang.String[] args)