ApsGis.dll

UTM.ConvertUtmToGeodetic(Double, Double, UtmHemisphere, UtmZone, Double, Double, Double, Double, String) Method

Converts a UTM coordinate to a Geodetic coordinate on the user defined reference ellipsoid.

public static bool ConvertUtmToGeodetic(
   double semiMajorAxisAInM,
   double inverseFlattening,
   UtmHemisphere utmHemisphere,
   UtmZone utmZone,
   double xInM,
   double yInM,
   out double latInDeg,
   out double lonInDeg,
   out string errorMessage
);

Parameters

semiMajorAxisAInM
a semi major axis A (in meters) of the user defined reference ellipsoid
inverseFlattening
an inverse flattening of the user defined reference ellipsoid
utmHemisphere
a preferred UTM hemisphere
utmZone
a UTM zone
xInM
X (in meters) of the UTM coordinate
yInM
Y (in meters) of the UTM coordinate
latInDeg
the latitude (in decimal degrees) of the final Geodetic coordinate, passed by reference (out)
lonInDeg
the longitude (in decimal degrees) of the final Geodetic coordinate, passed by reference (out)
errorMessage
an error message, passed by reference (out), that contains detailed error / warning information

Return Value

true - if the conversion succeeded, false - if the conversion failed

Remarks

The function verifies validity of the input arguments before running the conversion. The valid semi major axis A (in meters) is a real number greater than 0. The valid inverse flattening is a real number greater than 0. The valid UTM X is a real number in the range between -MaxX and MaxX. MaxX is the function of the reference ellipsoid, the UTM hemisphere and the UTM zone. The valid UTM Y is a real number in the range between -MaxY and MaxY. MaxY is the function of the reference ellipsoid, the UTM hemisphere 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.ConvertUtmToGeodetic method from C# code:

 string errorMessage = String.Empty;
 
 double semiMajorAxisA = 6378137;
 double inverseFlattening= 298.257223563;
 
 UtmHemisphere utmHemisphere = UtmHemisphere.Northern;
 UtmZone utmZone = UtmZone.Zone_18_from_78W_to_72W;

 double xInM = 322288.85200403;
 double yInM = 4306469.77888406;

 double latInDeg = Double.NaN;
 double lonInDeg = Double.NaN;
 
 if (UTM.ConvertUtmToGeodetic(semiMajorAxisA, inverseFlattening, utmHemisphere, utmZone, xInM, yInM, out latInDeg, out lonInDeg, out errorMessage))
 {
     Console.WriteLine("Conversion succeeded.");
     Console.WriteLine("LatInDeg: " + latInDeg.ToString());
     Console.WriteLine("LonInDeg: " + lonInDeg.ToString());
 }
 else
 {
     Console.WriteLine("Conversion failed. " + errorMessage);
 }
 

See Also

UTM Class | ApsGis Namespace | UTM.ConvertUtmToGeodetic Overload List