ApsGis.dll

Mercator.ParseCentralMeridian Method

Parses central meridian from the provided string, assuming that the DecimalDegrees (DD) format or the DegreesMinutesSecondsDirection (DMS) format is in use.

public static bool ParseCentralMeridian(
   string str,
   int precision,
   out double cmInDeg,
   out string errorMessage
);

Parameters

str
a string to be parsed
precision
a precision used in parsing
cmInDeg
the parsed central meridian 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 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: -77.049. DegreesMinutesSecondsDirection - indicates the DMS format or DDD MM SS.SSSS [E, W], for example: 77 2 56.4 W.

Example

This sample shows how to call the Mercator.ParseCentralMeridian method from C# code:

 string errorMessage = String.Empty;
 
 string str = "77 2 56.4 W";
 int precision = 10;
 double cmInDeg = Double.NaN;

 if (Mercator.ParseCentralMeridian(str, precision, out cmInDeg, out errorMessage))
 {
     Console.WriteLine("CmInDeg: " + cmInDeg.ToString());
 }
 else
 {
     Console.WriteLine(errorMessage);
 }
 

See Also

Mercator Class | ApsGis Namespace