ApsGis.dll

Geodetic.Longitude.IsValidLonitudeInDeg Method

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

public static bool IsValidLonitudeInDeg(
   double lonInDeg,
   out string errorMessage
);

Parameters

lonInDeg
a longitude (in decimal degrees) to validate
errorMessage
an error message, passed by reference (out), that contains detailed information in case of the invalid longitude

Return Value

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

Remarks

The valid longitude is a real number in the range from -180 to 180.

Example

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

string errorMessage = String.Empty;
double longitudeInDeg = 78.5;
            
if (Geodetic.Longitude.IsValidLongitudeInDeg(longitudeInDeg, out errorMessage))
{
    Console.WriteLine("Longitude is valid.");
}
else
{
    Console.WriteLine(errorMessage);
}

See Also

Longitude Class | ApsGis Namespace