ApsGis.dll

Geodetic.Latitude.LatInDmsToDeg Method

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

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

Parameters

degrees
the degrees part of the latitude in DMS
minutes
the minutes part of the latitude in DMS
seconds
the seconds part of the latitude in DMS
latDirection
the direction part of the latitude in DMS
latInDeg
the result latitude in decimal degrees, 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 degree part is an integer number in the range from 0 (inclusive) to 90 (inclusive). The valid minutes part is an integer number in the range from 0 (inclusive) to 60 (exclusive). The valid seconds part is a real number in the range from 0 (inclusive) to 60 (exclusive).

Example

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

 string errorMessage = String.Empty;
 
 LatitudeDirection latDirection = LatitudeDirection.Northern;
 int degreesPart = 34;
 int minutesPart = 45;
 double secondsPart = 56.789;
 double latInDeg = Double.NaN;

 if (Geodetic.Latitude.LatInDmsToDeg(degrees, minutes, seconds, latDirection, out latInDeg, out errorMessage))
 {
     Console.WriteLine("Latitude in degrees: " + latInDeg.ToString());
 }
 else
 {
     Console.WriteLine(errorMessage);
 }
 

See Also

Latitude Class | ApsGis Namespace