ApsGis.dll

Geodetic.Longitude.ParseLongitudeSign Method

Parses longitude direction from the provided string with a geographic coordinate.

public static bool ParseLongitudeSign(
   string str,
   GeoCoordinateFormat geographicCoordinateFormat,
   out LongitudeDirection lonDirection,
   out string errorMessage
);

Parameters

str
a string to be parsed
geographicCoordinateFormat
a geographic coordinate format used in the string
lonDirection
the parsed longitude direction, 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 does not verifies if the string contains geographic coordinate in the valid format.

Example

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

string errorMessage = String.Empty;

string str = "13.7480278 W";
GeoCoordinateFormat geographicCoordinateFormat = GeoCoordinateFormat.DecimalDegrees;
LongitudeDirection lonDirection = LongitudeDirection.NotDefined;

if (Geodetic.Longitude.ParseLongitudeDirection(str, geographicCoordinateFormat, out lonDirection, out errorMessage))
{
    Console.WriteLine(lonDirection.ToString());
}
else
{
    Console.WriteLine(errorMessage);
}

See Also

Longitude Class | ApsGis Namespace