I want to create a circle with IPoint P and radius r in ArcEngine and then I need to cast it to an IGeometry. Does anyone know how to do this?

ESRI ArcEngine 10 VS2010 C#


found it

ISegmentCollection p = new PolygonClass();
p.SetCircle(mousepoint, 20);
IGeometry circleGeo = p as IGeometry;
  • Kudos for this. You are correct, and I don't think a lot of people know about the SegmentCollection and the various Set methods that get used along with it. This answer adds greatly useful information to the gis.stackexchange pool. – celticflute Jan 17 '11 at 22:26
  • @celticflute sorry to report that it doesn't work properly after some testing – patrick Jan 17 '11 at 22:34
  • I'm curious - what kind of test did it fail? – Kirk Kuykendall Jan 18 '11 at 2:47
  • @Kirk Kuykendall it created the circle in the wrong place – patrick Jan 18 '11 at 14:47
  • 1
    @Kirk, iterationx: I just tested this and seems to work perfectly for me... – Petr Krebs Jan 19 '11 at 17:39

EllipticArcClass ellipticalArc = new EllipticArcClass();

IEnvelope env = new EnvelopeClass();

IPoint lowerLeft = new PointClass();

lowerLeft.X = centerPoint.X - width;

lowerLeft.Y = centerPoint.Y - height;

IPoint upperRight = new PointClass();

upperRight.X = centerPoint.X + width;

upperRight.Y = centerPoint.Y + height;

env.LowerLeft = lowerLeft;

env.UpperRight = upperRight;


IGraphicTrackerSymbol graphicTrackerSymbol = this.graphicTracker.CreateSymbol(simpleFillSymbol, null);

int shapeId = this.graphicTracker.Add(ellipticalArc, graphicTrackerSymbol);


Another method is to cast your point to ITopologicalOperator and use the Buffer method to buffer the point by the radius.

  • I think this method works for Projected coordinate systems, but will give strange results if you are working with a Geographic coordinate system. – Devdatta Tengshe Jan 31 '11 at 4:07

I prefer the ISegmentCollection solution myself, but you can also recast your IPoint or IGeometry as ITopologicalOperator and call the Buffer method.

  • -1 for basically taking two of the answers, restating the same, and adding no value. – Petr Krebs Jan 29 '11 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.