ApsGis.dll

Cartesian.ParseLatitudeInDmsd Method

Parses latitude from the provided string, assuming that the DegreesMinutesSecondsDirection (DMS) format is in use.

public static bool ParseLatitudeInDmsd(
   string str,
   int precision,
   out double latInDeg,
   out string errorMessage
);

Parameters

str
a string to be parsed
precision
a precision used in parsing
latInDeg
the parsed latitude in decimal degrees, 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 parsing results. The valid precision is an integer number in the range from 0 (inclusive) to 15 (inclusive). The function recognizes the DegreesMinutesSecondsDirection (DMS) format, i.e. DDD MM SS.SSSS [N, S], for example: 38 53 20.9 N.

Example

This sample shows how to call the Cartesian.ParseLatitudeInDmsd method from C# code:

 string errorMessage = String.Empty;
 
 string str = "38 53 20.9 N";
 int precision = 10;
 double latInDeg = Double.NaN;

 if (Cartesian.ParseLatitudeInDmsd(str, precision, out latInDeg, out errorMessage))
 {
     Console.WriteLine("LatInDeg: " + latInDeg.ToString());
 }
 else
 {
     Console.WriteLine(errorMessage);
 }
 

See Also

Cartesian Class | ApsGis Namespace