Parses longitude from the provided string for the user defined reference ellipsoid and the specified UTM zone, assuming that the DecimalDegrees (DD) format or the DegreesMinutesSecondsDirection (DMS) format is in use.
true - the function has succeeded, false - it has failed
The function verifies validity of its arguments before running parsing. 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 precision is an integer number in the range from 0 (inclusive) to 15 (inclusive). The function recognizes two formats: DecimalDegrees and DegreesMinutesSecondsDirection (DMS). DecimalDegrees - indicates the decimal degrees format, for example: -77.049. DegreesMinutesSecondsDirection - indicates the DMS format or DDD MM SS.SSSS [E, W], for example: 77 2 56.4 W. The function verifies the validity of the parsed result.
This sample shows how to call the UTM.ParseLongitude method from C# code:
string errorMessage = String.Empty;
double semiMajorAxisA = 6378137;
double inverseFlattening = 298.257223563;
UtmZone utmZone = UtmZone.Zone_18_from_78W_to_72W;
string str = "77 2 56.4 W";
int precision = 10;
double lonInDeg = Double.NaN;
if (UTM.ParseLongitude(semiMajorAxisA, inverseFlattening, utmZone, str, precision, out lonInDeg, out errorMessage))
{
Console.WriteLine("LonInDeg: " + lonInDeg.ToString());
}
else
{
Console.WriteLine(errorMessage);
}
UTM Class | ApsGis Namespace | UTM.ParseLongitude Overload List