ApsGis.dll

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

Parses UTM X from the provided string for a reference ellipsoid.

public static bool ParseUtmXInM(
   double semiMajorAxisAInM,
   double inverseFlattening,
   UtmZone utmZone,
   UtmHemisphere utmHemisphere,
   string str,
   out double xInM,
   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
utmZone
a UTM zone
utmHemisphere
a preferred UTM hemisphere
str
a string to be parsed
xInM
the parsed UTM X, passed by reference (out)
errorMessage
an error message, passed by reference (out), that contains detailed error / warning information

Return Value

true - the function has succeeded, false - it has failed

Remarks

The function verifies validity of the parsing result. 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 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.ParseUtmXInM 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;
 
 string str = "322288.85200403";
 double xInM = Double.NaN;

 if (UTM.ParseUtmXInM(semiMajorAxisA, inverseFlattening, utmZone, utmHemisphere, str, out xInM, out errorMessage))
 {
     Console.WriteLine("X, in m: " + xInM.ToString());
 }
 else
 {
     Console.WriteLine(errorMessage);
 }
 

See Also

UTM Class | ApsGis Namespace | UTM.ParseUtmXInM Overload List