Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Wrong values for Geographic Transformation

$
0
0
Hi!
I want to transform a number of points from MGI_Austria_GK_East to GCS_WGS_1984. When I do that in ArcMap (with the "Project" tool) everything works perfectly. Now I tried to do the same programmatically in C#, but the results are totally wrong. Please help and tell me, what I am doing wrong! Thanks a lot!
Here's my code:

Code:

private void btnStartTransform_Click(object sender, EventArgs e)
        {
            Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
            System.Object obj = Activator.CreateInstance(factoryType);
            ISpatialReferenceFactory2 spatialReferenceFactory2 = obj as ISpatialReferenceFactory2;

            IGeoTransformation geoTransformation = spatialReferenceFactory2.CreateGeoTransformation((int)esriSRGeoTransformation3Type.esriSRGeoTransformation_MGI_To_WGS_1984_3) as IGeoTransformation;

            //In Point (MGI_Austria_GK_East): -50545.72, 362614.3
            //Out Point should be: (WGS1984 Longitude/Latitude in decimal degree): 15.649504022257, 48.3997325959545

            double[] inPoints = new double[2];
            double[] outPoints = new double[2];

            inPoints[0] = -50545.72d;
            inPoints[1] = 362614.3d;

            geoTransformation.TransformPointsFF(esriTransformDirection.esriTransformForward, 1, ref inPoints[0], ref outPoints[0]);

            //Values are: -6.2468353377012207, 89.99439100965067 ????
            System.Windows.Forms.MessageBox.Show("Longitude:" + outPoints[0] + ", Latitude: " + outPoints[1]);
        }


Viewing all articles
Browse latest Browse all 1374

Trending Articles