Parses longitude from the provided string, assuming that the DecimalDegrees (DD) format or the DegreesMinutesSecondsDirection (DMS) format is in use.
true - the function has succeeded, false - it has failed
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: 38.889139;. DegreesMinutesSecondsDirection - indicates the DMS format or DDD MM SS.SSSS [E, W], for example: 38 53 20.9 W.
This sample shows how to call the Geodetic.Longitude.ParseLongitude method from C# code:
string errorMessage = String.Empty;
string str = "38 53 20.9 W";
int precision = 10;
double lonInDeg = Double.NaN;
if (Geodetic.Longitude.ParseLongitude(str, precision, includePoles, out lonInDeg, out errorMessage))
{
Console.WriteLine("LatInDeg: " + lonInDeg.ToString());
}
else
{
Console.WriteLine(errorMessage);
}