ApsGis.dll

Geodetic.CalculateDestination(Double, Double, Double, Double, Double, Double, Double, Double, String) Method

Calculates a destination geodetic coordinate on the surface of the user defined reference ellipsoid, for the specified starting point on the ellipsoid, bearing (in decimal degrees) and distance (in meters).

public static bool CalculateDestination(
   double semiMajorAxisAInM,
   double inverseFlattening,
   double startLatInDeg,
   double startLonInDeg,
   double bearingInDeg,
   double distanceInM,
   out double destinationLatInDeg,
   out double destinationLonInDeg,
   out string errorMessage
);

Parameters

semiMajorAxisAInM
a semi major axis A (in meters) of the user defined reference ellipsoid
inverseFlattening
an inverse flattening of the user defined reference ellipsoid
startLatInDeg
the latitude (in decimal degrees) of the starting geodetic coordinate
startLonInDeg
the longitude (in decimal degrees) of the starting geodetic coordinate
bearingInDeg
a bearing (in decimal degrees) from the starting coordinate to the destination coordinate
distanceInM
a distance (in meters) from the starting coordinate to the destination coordinate
destinationLatInDeg
the latitude (in decimal degrees) of the calculated destination geodetic coordinate, passed by reference (out)
destinationLonInDeg
the longitude (in decimal degrees) of the calculated destination geodetic coordinate, passed by reference (out)
errorMessage
an error message, passed by reference (out), that contains detailed error / warning information

Return Value

true - the function has succeeded, false - it has failed

Remarks

The function verifies validity of its arguments.

Example

This sample shows how to call the Geodetic.CalculateDestination method from C# code:

 double semiMajorAxisA = 6378137;
 double inverseFlattening = 298.257223563;

 string errorMessage = String.Empty;
 
 double startLatInDeg = 38.889139;
 double startLonInDeg = -77.049;
 
 double bearingInDeg = 322.506050;
 double distanceInM = 140.524904;
 
 double destinationLatInDeg = Double.NaN;
 double destinationLonInDeg = Double.NaN;
 
 if (Geodetic.CalculateDestination(semiMajorAxisA, inverseFlattening, startLatInDeg, startLonInDeg, bearingInDeg, distanceInM, out destinationLatInDeg, out destinationLonInDeg, out errorMessage))
 {
     Console.WriteLine("LatInDeg: " + destinationLatInDeg.ToString());
     Console.WriteLine("LonInDeg: " + destinationLonInDeg.ToString());
 }
 else
 {
     Console.WriteLine(errorMessage);
 }
 

See Also

Geodetic Class | ApsGis Namespace | Geodetic.CalculateDestination Overload List