Package org.hermit.geo

A library of various geodetic utilities for handling positions, directions and distances over the surface of the Earth, with a choice of algorithms from the fast and simple Haversine formula, to the super-accurate Vincenty formula.

See:
          Description

Interface Summary
GeoConstants Global constants for geodetic calculations.
 

Class Summary
AndoyerCalculator A geographic data calculator based on the Andoyer formula.
Azimuth This class represents a geographic azimuth -- ie.
Distance This class represents a geographic distance -- ie.
GeoCalculator Base class for geographic data calculators.
HaversineCalculator A geographic data calculator based on the Haversine formula.
PointOfInterest This class represents a point or area of interest.
PointOfInterest.BAND Class BAND represents an interesting band of latitudes.
PointOfInterest.LAT Class LAT represents an interesting line of latitude.
PointOfInterest.LON Class LON represents an interesting meridian, or a segment of a meridian.
PointOfInterest.POS Class POS represents an interesting position.
Position This class represents a geographic position -- ie.
Vector This class represents a vector over the Earth's surface -- ie.
VincentyCalculator A geographic data calculator based on Vincenty's formulae.
 

Enum Summary
GeoCalculator.Algorithm Definition of the algorithm to be used.
GeoConstants.Ellipsoid Selectable ellipsoids, for geodetic calculations.
 

Package org.hermit.geo Description

A library of various geodetic utilities for handling positions, directions and distances over the surface of the Earth, with a choice of algorithms from the fast and simple Haversine formula, to the super-accurate Vincenty formula.

Usage is pretty simple. Two rules to remember:

For example, positions on the Earth are represented by the Position class. You can create a Position in either of these ways:

    pos1 = new Position(latRadians, lonRadians);
    pos2 = Position.fromDegrees(latDegrees, lonDegrees);

You can then easily calculate the distance between Positions:

    Distance dist = pos1.distance(pos2);

Abstract representations are used to avoid issues of units, as, for example, with the Distance class used above. Having got a Distance, you can, when you need to, get its value in whatever units you like using provided accessors.

Multiple algorithms for calculating distances etc. are supported. The simplest, the Haversine formula, assumes a spherical Earth; it is fast and easy to use, but has an error of about 0.5%. The class GeoCalculator allows you to set what algorithm is in use. Note that the more complex calculators are based on an ellipsoidal Earth; since multiple ellipsoid approximations are (or have been) in use internationally, you need to say which one you want to use. For example:

    GeoCalculator.setAlgorithm(GeoCalculator.Algorithm.VINCENTY,
                               GeoConstants.Ellipsoid.AIRY1858);

You can, if you wish, use the individual calculator classes directly; this is not the canonical model, but may be useful if you wish to work with several different calculators.

The PointOfInterest class provides (somewhat) interesting textual descriptions of points on the Earth's surface. For example:

    currentLocMsg = PointOfInterest.describePosition(currentPos);
      --> "The Southern Tropics, 3.9 nm north of The Tropic of Capricorn"

See the On Watch application for an example use of this package.