ApsGis.dll

TM.ConvertTransverseMercatorToGeodetic(Double, Double, Double, Double, Double, Double, Double, String) Method

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

public static bool ConvertTransverseMercatorToGeodetic(
   double semiMajorAxisAInM,
   double inverseFlattening,
   double cmInDeg,
   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
cmInDeg
a central meridian (in decimal degrees) to validate
xInM
X (in meters) of the original TM coordinate
yInM
Y (in meters) of the original TM 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 central meridian (in degrees) is a real number in the range from -180.0 (inclusive) to 180.0 (inclusive). The valid Tm coordinate (X, Y) is a coordinate which is located within 4.0 degrees of the central meridian, excluding poles.

Example

This sample shows how to call the TM.ConvertTransverseMercatorToGeodetic method from C# code:

 string errorMessage = String.Empty;
 
 double semiMajorAxisA = 6378137;
 double inverseFlattening = 298.257223563;

 double cmInDeg = -70.5;
 double xInM = -729031.34520515;
 double yInM = 4678974.22718545;

 double latInDeg = Double.NaN;
 double lonInDeg = Double.NaN;
 
 if (TM.ConvertTransverseMercatorToGeodetic(semiMajorAxisA, inverseFlattening, cmInDeg, 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

TM Class | ApsGis Namespace | TM.ConvertTransverseMercatorToGeodetic Overload List