ApsGis.dll

Geodetic.Longitude.LonInDegToString Method

Converts a longitude in decimal degrees to DMS string.

public static bool LonInDegToString(
   double lonInDeg,
   LongitudeDirection preferredLonDirection,
   int precision,
   out string str,
   out string errorMessage
);

Parameters

lonInDeg
a longitude in decimal degrees
preferredLonDirection
a prefered longitude direction
precision
a precision
str
the result DMS string, 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. The valid longitude is a real number in the range from -180 (inclusive) to 180 (inclusive).

Example

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

string errorMessage = String.Empty;

double lonInDeg = 38.889139;
LongitudeDirection preferredLonDirection = LongitudeDirection.Western;
int precision = 2;
string str = String.Empty;

if (Geodetic.Longitude.LonInDegToDmsString(lonInDeg, preferredLonDirection, precision, out str, out errorMessage))
{
    Console.WriteLine("Longitude in degrees: " + lonInDeg.ToString());
}
else
{
    Console.WriteLine(errorMessage);
}

See Also

Longitude Class | ApsGis Namespace