AnsweredAssumed Answered

Can't replicate results via ArcObjects seen when data is projected on the fly

Question asked by almondo on May 30, 2012
Latest reply on May 31, 2012 by almondo

I'm creating polygon's (saving to a feature class) from lat/long data into geographic GCS_WGS_1984. If I overlay those polygons in ArcMap into a data frame that is set to NAD_1927_StatePlane_Oregon_North_FIPS_3601 and select a transformation of NAD_1927_To_WGS_1984_6 the polygons draw where I expect them to.

If I try and make this same project and transformation in code (saving the results to a different feature class) and then add it to the map (that has the same projection ... NAD_1927_StatePlane_Oregon_North_FIPS_3601) the polygon seems to line up 400+ ft. to the west. Any thoughts as to what I'm doing wrong?

Thanks in advance!


public void PolygonProject(ref IPolygon testPoly, IServerContext serverContext)
            ISpatialReferenceFactory spatialReferenceFactory = serverContext.CreateObject("esriGeometry.SpatialReferenceEnvironment") as ISpatialReferenceFactory;
            ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
            //spatialReference.SetFalseOriginAndUnits(-80.0000000232831, 39.9999999767169, 42949672.9);
            IProjectedCoordinateSystem projectedCoordinateSystem = spatialReferenceFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1927SPCS_ORNorth);      
            //projectedCoordinateSystem.SetDomain(-117528700, 121528699.999999, -98145000, 140912399.999999);
            IGeoTransformation geoTransformation = spatialReferenceFactory.CreateGeoTransformation((int)esriSRGeoTransformationType.esriSRGeoTransformation_NAD1927_To_WGS1984_6) as IGeoTransformation;        
            IGeometry2 locatePolyGeom = (IGeometry2)testPoly;
            locatePolyGeom.ProjectEx(projectedCoordinateSystem as ISpatialReference, esriTransformDirection.esriTransformForward, geoTransformation, false, 0, 0);