ApsGis.dll

Geodetic.Latitude.LatInDegToDmsString Method

Converts a latitude in decimal degrees to DMS string.

public static bool LatInDegToDmsString(
   double latInDeg,
   LatitudeDirection preferredLatDirection,
   int precision,
   out string str,
   out string errorMessage
);

Parameters

latInDeg
a latitude in decimal degrees
preferredLatDirection
a prefered latitude 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 latitude is a real number in the range from -90 (inclusive) to 90 (inclusive).

Example

This sample shows how to call the Geodetic.Latitude.LatInDegToDmsString method from C# code:

string errorMessage = String.Empty;

double latInDeg = 38.889139;
LatitudeDirection preferredLatDirection = LatitudeDirection.Northern;
int precision = 2;
string str = String.Empty;

if (Geodetic.Latitude.LatInDegToDmsString(latInDeg, preferredLatDirection, precision, out str, out errorMessage))
{
    Console.WriteLine("Latitude in degrees: " + latInDeg.ToString());
}
else
{
    Console.WriteLine(errorMessage);
}

See Also

Latitude Class | ApsGis Namespace