Package ucar.unidata.geoloc
Class Bearing
java.lang.Object
ucar.unidata.geoloc.Bearing
Computes the distance, azimuth, and back azimuth between
two lat-lon positions on the Earth's surface. Reference ellipsoid is the WGS-84 by default.
You may use a default Earth (EarthEllipsoid.WGS84) or you may define your own using
a ucar.unidata.geoloc.Earth object.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BearingcalculateBearing(double lat1, double lon1, double lat2, double lon2) Computes distance (in km), azimuth (degrees clockwise positive from North, 0 to 360), and back azimuth (degrees clockwise positive from North, 0 to 360), from latitude-longituide point pt1 to latitude-longituide pt2.static BearingcalculateBearing(Earth e, double lat1, double lon1, double lat2, double lon2) Computes distance (in km), azimuth (degrees clockwise positive from North, 0 to 360), and back azimuth (degrees clockwise positive from North, 0 to 360), from latitude-longituide point pt1 to latitude-longituide pt2.static BearingcalculateBearing(Earth e, LatLonPoint pt1, LatLonPoint pt2) Calculate the bearing between the 2 points.static BearingcalculateBearing(LatLonPoint pt1, LatLonPoint pt2) Calculate the bearing between the 2 points.doublegetAngle()Get the azimuth in degrees, 0 = north, clockwise positivedoubleGet the back azimuth in degrees, 0 = north, clockwise positivedoubleGet the distance in kilometerstoString()
-
Constructor Details
-
Bearing
public Bearing(double azimuth, double backazimuth, double distance)
-
-
Method Details
-
calculateBearing
Calculate the bearing between the 2 points. See calculateBearing below.- Parameters:
e- Earth object (defines radius & flattening)pt1- Point 1pt2- Point 2- Returns:
- The bearing
-
calculateBearing
Calculate the bearing between the 2 points. See calculateBearing below. Uses default Earth object.- Parameters:
pt1- Point 1pt2- Point 2- Returns:
- The bearing
-
calculateBearing
Computes distance (in km), azimuth (degrees clockwise positive from North, 0 to 360), and back azimuth (degrees clockwise positive from North, 0 to 360), from latitude-longituide point pt1 to latitude-longituide pt2. Uses default Earth object.- Parameters:
lat1- Lat of point 1lon1- Lon of point 1lat2- Lat of point 2lon2- Lon of point 2- Returns:
- a Bearing object with distance (in km), azimuth from pt1 to pt2 (degrees, 0 = north, clockwise positive)
-
calculateBearing
Computes distance (in km), azimuth (degrees clockwise positive from North, 0 to 360), and back azimuth (degrees clockwise positive from North, 0 to 360), from latitude-longituide point pt1 to latitude-longituide pt2.Algorithm from U.S. National Geodetic Survey, FORTRAN program "inverse," subroutine "INVER1," by L. PFEIFER and JOHN G. GERGEN. See http://www.ngs.noaa.gov/TOOLS/Inv_Fwd/Inv_Fwd.html
Original documentation:
Reference ellipsoid is the WGS-84 ellipsoid.
SOLUTION OF THE GEODETIC INVERSE PROBLEM AFTER T.VINCENTY
MODIFIED RAINSFORD'S METHOD WITH HELMERT'S ELLIPTICAL TERMS
EFFECTIVE IN ANY AZIMUTH AND AT ANY DISTANCE SHORT OF ANTIPODAL
STANDPOINT/FOREPOINT MUST NOT BE THE GEOGRAPHIC POLE
See http://www.colorado.edu/geography/gcraft/notes/datum/elist.html Requires close to 1.4 E-5 seconds wall clock time per call on a 550 MHz Pentium with Linux 7.2.- Parameters:
e- Earth object (defines radius and flattening)lat1- Lat of point 1lon1- Lon of point 1lat2- Lat of point 2lon2- Lon of point 2- Returns:
- a Bearing object with distance (in km), azimuth from pt1 to pt2 (degrees, 0 = north, clockwise positive)
-
getAngle
public double getAngle()Get the azimuth in degrees, 0 = north, clockwise positive- Returns:
- azimuth in degrees
-
getBackAzimuth
public double getBackAzimuth()Get the back azimuth in degrees, 0 = north, clockwise positive- Returns:
- back azimuth in degrees
-
getDistance
public double getDistance()Get the distance in kilometers- Returns:
- distance in km
-
toString
-