ApsGis.dll

Geodetic.ParseBearingInDeg Method

Parses bearing (in decimal degrees) from the provided string.

public static bool ParseBearingInDeg(
   string str,
   int precision,
   out double bearingInDeg,
   out string errorMessage
);

Parameters

str
a string to be parsed
precision
a precision used in parsing
bearingInDeg
the parsed bearing, 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 and the parsing result. The valid precision is an integer number in the range from 0 (inclusive) to 15 (inclusive). The valid bearing is a real number.

Example

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

 string errorMessage = String.Empty;
 
 string str = "78.5";
 int precision = 7;
 double bearingInDeg = Double.NaN;

 if (Geodetic.ParseBearingInDeg(str, precision, out bearingInDeg, out errorMessage))
 {
     Console.WriteLine("Bearing, in degrees: " + bearingInDeg.ToString());
 }
 else
 {
     Console.WriteLine(errorMessage);
 }
 

See Also

Geodetic Class | ApsGis Namespace