ApsGis.dll

UTM.IsValidLonitudeInDeg Method

Checks if the provided longitude (in decimal degrees) is valid for a reference ellipsoid, i.e. if it can be used in GIS calculations in the UTM coordinate system.

public static bool IsValidLonitudeInDeg(
   GeoEllipsoid ge,
   UtmZone utmZone,
   double lonInDeg,
   out string errorMessage
);

Parameters

ge
a predefined reference ellipsoid (GeoEllipsoid)
utmZone
a UTM zone
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 -MaxLon (exclusive) to MaxLon (exclusive). MaxLon is the function of the reference ellipsoid and the UTM zone. It takes into account the 40.0 km overlap with the adjacent UTM zones and 0.5 degree overlap with UPS (Univeral Polar Stereographic) projection.

Example

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

string errorMessage = String.Empty;
double lonInDeg = 38.889139;
UtmZone utmZone = UtmZone.Zone_01_from_180W_to_174W;
            
if (UTM.IsValidLongitudeInDeg(ge, utmZone, lonInDeg, out errorMessage))
{
    Console.WriteLine("Longitude is valid.");
}
else
{
    Console.WriteLine(errorMessage);
}

See Also

UTM Class | ApsGis Namespace