ApsGis.dll

TM.ParseLatitude(Double, Double, String, Int32, Double, String) Method

Parses latitude from the provided string for the user defined reference ellipsoid, assuming that the DecimalDegrees (DD) format or the DegreesMinutesSecondsDirection (DMS) format is in use.

public static bool ParseLatitude(
   double semiMajorAxisAInM,
   double inverseFlattening,
   string str,
   int precision,
   out double latInDeg,
   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
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 before running parsing. The valid semi major axis A (in meters) is a real number greater than 0. The valid inverse flattening is a real number greater than 0. The valid precision is an integer number in the range from 0 (inclusive) to 15 (inclusive). The function recognizes two formats: DecimalDegrees and DegreesMinutesSecondsDirection (DMS). DecimalDegrees - indicates the decimal degrees format, for example: 38.889139;. DegreesMinutesSecondsDirection - indicates the DMS format or DDD MM SS.SSSS [N, S], for example: 38 53 20.9 N. The function verifies the validity of the parsed result also. The valid latitude is a real number in the range from -MaxLat (exclusive) to MaxLat (exclusive), where MaxLat is the function of the reference ellipsoid.

Example

This sample shows how to call the TM.ParseLatitude method from C# code:

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

 if (TM.ParseLatitude(semiMajorAxisA, inverseFlattening, str, precision, out latInDeg, out errorMessage))
 {
     Console.WriteLine("LatInDeg: " + latInDeg.ToString());
 }
 else
 {
     Console.WriteLine(errorMessage);
 }
 

See Also

TM Class | ApsGis Namespace | TM.ParseLatitude Overload List