Converts a Geodetic coordinate to a Mercator coordinate on the user defined reference ellipsoid.
true - if the conversion succeeded, false - if the conversion failed
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 is a real number in the range from -180.0 (inclusive) to 180.0 (inclusive). The valid latitude is a real number in the range from -90.0 (exclusive) to 90.0 (exclusive). The valid longitude is a real number in the range from -180.0 (inclusive) to 180.0 (inclusive).
This sample shows how to call the Mercator.ConvertGeodeticToMercator method from C# code:
string errorMessage = String.Empty;
double semiMajorAxisA = 6378137;
double inverseFlattening = 298.257223563;
double cmInDeg = -70.5;
double latInDeg = 38.889139;
double lonInDeg = -77.049;
double xInM = Double.NaN;
double yInM = Double.NaN;
if (Mercator.ConvertGeodeticToMercator(semiMajorAxisAInM, inverseFlattening, cmInDeg, latInDeg, lonInDeg, out xInM, out yInM, out errorMessage))
{
Console.WriteLine("Conversion succeeded.");
Console.WriteLine("X, in m: " + xInM.ToString());
Console.WriteLine("Y, in m: " + yInM.ToString());
}
else
{
Console.WriteLine("Conversion failed. " + errorMessage);
}
Mercator Class | ApsGis Namespace | Mercator.ConvertGeodeticToMercator Overload List