AnsweredAssumed Answered

[ArcEngine] How can I convert a shape from geographic to projected?

Question asked by Adjutant on Jun 18, 2012
Latest reply on Jul 18, 2012 by Adjutant
Hi,
This question is derived from http://forums.arcgis.com/threads/56517-ArcEngine-Drawing-projected-geometry?p=194053.

When developing a new test third party application that uses ArcEngine, I create and draw a simple circle at a location into a default, newly instantiated graphic tracker.
The shape is displayed as a perfect circle.

If I were to draw this shape using a projection, in order to represent it as it would appear on the earth's surface - but on a flat projected surface of the earth's surface, then it would appear as an ellipse (especially at 60 degrees LAT North).

I've tried the following code to perform this conversion, but it does not work - does anyone know why?
          PointClass centroid = new PointClass() { X = 0, Y = 60};           PointClass permiterPoint = new PointClass() { X = 4, Y = 60 };           CircularArcClass circularArc = new CircularArcClass();           circularArc.PutCoords(centroid, permiterPoint, permiterPoint, esriArcOrientation.esriArcClockwise);            IPolygon polygon = new PolygonClass();           segmentCollection = polygon as ISegmentCollection;           segmentCollection.AddSegment(circularArc);            ESRI.ArcGIS.Geometry.ISpatialReference2 spatialRef;           ESRI.ArcGIS.Geometry.ISpatialReferenceFactory2 factory = (ISpatialReferenceFactory2)new ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment();           spatialRef = (ISpatialReference2)factory.CreateSpatialReference((int)ESRI.ArcGIS.Geometry.esriSRGeoCSType.esriSRGeoCS_WGS1984);            polygon.Project(spatialRef);            // ... Add shape to tracker

Outcomes