ApsGis.dll

Geodetic.Latitude.IsValidLatitudeInDeg Method

Checks if the provided latitude (in decimal degrees) is valid.

public static bool IsValidLatitudeInDeg(
   double latInDeg,
   bool includePoles,
   out string errorMessage
);

Parameters

latInDeg
a latitude (in decimal degrees) to validate
includePoles
include poles in the valid range
errorMessage
an error message, passed by reference (out), that contains detailed information in case of the invalid latitude

Return Value

true - if the latitude is valid, false - if the latitude is invalid

Remarks

The valid latitude is a real number in the range from -90 to 90.

Example

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

string errorMessage = String.Empty;
double latitudeInDeg = 78.5;
            
if (Geodetic.Latitude.IsValidLatitudeInDeg(latitudeInDeg, out errorMessage))
{
    Console.WriteLine("Latitude is valid.");
}
else
{
    Console.WriteLine(errorMessage);
}

See Also

Latitude Class | ApsGis Namespace