|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hermit.geo.Position
public class Position
This class represents a geographic position -- ie. a latitude and
longitude. It provides utility methods for the common geodetic
operations of finding distance and azimuth between points, or projecting
to a point given a distance and azimuth.
The geodetic operations in this class are based on a simple spherical
model of the Earth, using the haversine formulae; this is fast, and
provides accuracy of about 0.5%, which will be adequate for many
purposes. Users desiring greater accuracy should use the
VincentyCalculator
subclass.
References:
Field Summary | |
---|---|
static Position |
UNKNOWN
Constant representing an unknown position. |
Constructor Summary | |
---|---|
Position(double latRadians,
double lonRadians)
Create a Position from a geographic latitude and longitude. |
|
Position(Position pos)
Create a Position from a Position. |
Method Summary | |
---|---|
Azimuth |
azimuth(Position pos)
Calculate the azimuth (bearing) from this position to another, using the haversine formula, which is based on a spherical approximation of the Earth. |
Distance |
distance(Position pos)
Calculate the distance between this position and another, using the haversine formula, which is based on a spherical approximation of the Earth. |
java.lang.String |
formatDegMin()
Format this position for user display in degrees and minutes. |
java.lang.String |
formatDegMinSec()
Format this position for user display in degrees and minutes. |
static Position |
fromDegrees(double latDegrees,
double lonDegrees)
Create a Position from a geographic latitude and longitude given in degrees. |
double |
getCentreDistance()
Get the distance from the centre of the Earth to this Position. |
double |
getGeocentricLat()
Get the geocentric latitude of this Position in radians. |
double |
getLatDegs()
Get the geographic latitude of this Position in degrees. |
double |
getLatRads()
Get the geographic latitude of this Position in radians. |
double |
getLonDegs()
Get the longitude of this Position in degrees. |
double |
getLonRads()
Get the longitude of this Position in radians. |
Distance |
latDistance(double lat)
Calculate the distance between this position and a given latitude, based on a spherical approximation of the Earth. |
Position |
offset(Distance distance,
Azimuth azimuth)
Calculate a second position given its offset from this one, using the current geodetic calculator -- see GeoCalculator . |
Position |
offset(Vector vector)
Calculate a second position given its offset from this one, using the current geodetic calculator -- see GeoCalculator . |
java.lang.String |
toString()
Format this position as a String. |
Vector |
vector(Position pos)
Calculate the distance and azimuth from this position to another, using the haversine formula, which is based on a spherical approximation of the Earth. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Position UNKNOWN
Constructor Detail |
---|
public Position(double latRadians, double lonRadians)
latRadians
- Geographic latitude in radians of the desired
position, positive north.lonRadians
- Longitude in radians of the desired position,
positive east.public Position(Position pos)
pos
- The Position to copy.Method Detail |
---|
public static Position fromDegrees(double latDegrees, double lonDegrees)
latDegrees
- Geographic latitude in degrees of the desired
position, positive north.lonDegrees
- Longitude in degrees of the desired position,
positive east.
public double getLatRads()
public double getGeocentricLat()
From AA chapter 11.
public double getLonRads()
public double getLatDegs()
public double getLonDegs()
public double getCentreDistance()
From AA chapter 11.
public Vector vector(Position pos)
pos
- Position to calculate the vector to.
public Distance distance(Position pos)
pos
- Position to calculate the distance to.
public Distance latDistance(double lat)
lat
- Latitude in radians to calculate the distance to.
public Azimuth azimuth(Position pos)
pos
- Position to calculate the azimuth to.
public Position offset(Vector vector)
GeoCalculator
.
vector
- The Vector to the desired position.
public Position offset(Distance distance, Azimuth azimuth)
GeoCalculator
.
distance
- The Distance to the desired position.azimuth
- The Azimuth to the desired position.
public java.lang.String formatDegMin()
public java.lang.String formatDegMinSec()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |