Select to view content in your preferred language

Problem with projectEx

579
2
09-28-2010 03:18 AM
AndreasRuloffs
New Contributor
Hello,
I'm trying to transform a Point from DHDN to WGS84 using this Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Geometry;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            ISpatialReference incomingCoordSystem = null;
            ISpatialReference outgoingCoordSystem = null;
            IGeoTransformation trans = null;
            IPoint sourceGeom = new PointClass();           
            SpatialReferenceEnvironmentClass sRefEnv = new SpatialReferenceEnvironmentClass();
            try
            {
                incomingCoordSystem = sRefEnv.CreateGeographicCoordinateSystem(4314);   //DHDN
                outgoingCoordSystem = sRefEnv.CreateGeographicCoordinateSystem(4326);   //WGS84
                trans = (IGeoTransformation)sRefEnv.CreateGeoTransformation(108206);
            }
            catch (Exception e)
            {
                throw e;
            }
            sourceGeom.X = 2573637.250571501;
            sourceGeom.Y = 5718583.437388875;
            sourceGeom.SpatialReference = incomingCoordSystem;
            (sourceGeom as IGeometry2).ProjectEx(outgoingCoordSystem, esriTransformDirection.esriTransformForward, trans, false, 0, 0);
            Console.WriteLine("x=" + sourceGeom.X + " ; y=" + sourceGeom.Y);
            Console.ReadKey();
        }
    }
}


It seems to work, but the result is:
x=-2.7588 ; y=-16.5578
I would expect somthing arount:
51 ; 7
Thanks a lot,

Andreas Ruloffs

viasecure Deutschland GmbH
0 Kudos
2 Replies
MelitaKennedy
Esri Notable Contributor
Hello,
I'm trying to transform a Point from DHDN to WGS84 using this Code:



It seems to work, but the result is:
x=-2.7588 ; y=-16.5578
I would expect somthing arount:
51 ; 7
Thanks a lot,

Andreas Ruloffs

viasecure Deutschland GmbH


Hello Andreas,

Your coordinates aren't in decimal degrees, so they must be in a projected coordinate system. I think the input points are using DHDN Germany 2: 31492.

Melita
0 Kudos
AndreasRuloffs
New Contributor
Thanks a lot,
and sorry for the stupidity of my question.
Works fine when I use the right system.
Bye,
Andreas Ruloffs

viasecure Deutschland
0 Kudos