ApsGis.dll

Geodetic.Latitude.LatInDegToDms Method

Converts a latitude in decimal degrees to the latitude in DMS (degrees, minutes, seconds).

public static bool LatInDegToDms(
   double latInDeg,
   LatitudeDirection preferredLatDirection,
   out int degrees,
   out int minutes,
   out double seconds,
   out LatitudeDirection latDirection,
   out string errorMessage
);

Parameters

latInDeg
a latitude in decimal degrees
preferredLatDirection
a prefered latitude direction
degrees
the degrees part of the result latitude in DMS, passed by reference (out)
minutes
the minutes part of the result latitude in DMS, passed by reference (out)
seconds
the seconds part of the result latitude in DMS, passed by reference (out)
latDirection
the direction part of the result latitude in DMS, 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.LatInDegToDms method from C# code:

 string errorMessage = String.Empty;
 
 double latInDeg = 38.889139;
 LatitudeDirection preferredLatDirection = LatitudeDirection.Northern;
 int degreesPart ;
 int minutesPart;
 double secondsPart = Double.NaN;
 LatitudeDirection latDirection = LatitudeDirection.NotDefined;

 if (Geodetic.Latitude.LatInDegToDms(latInDeg, preferredLatDirection, out degrees, out minutes, out seconds, out latDirection, out errorMessage))
 {
     Console.WriteLine("Degrees part, DMS: " + degrees.ToString());
     Console.WriteLine("Minutes part, DMS: " + minutes.ToString());
     Console.WriteLine("Seconds part, DMS: " + seconds.ToString());
 }
 else
 {
     Console.WriteLine(errorMessage);
 }
 

See Also

Latitude Class | ApsGis Namespace