Select to view content in your preferred language

draw circle with radius in meters on a map with geographic coordinate system

3965
3
10-19-2010 07:34 PM
DarkoRadiceski
Emerging Contributor
Hi all,

I have been looking around but havent been able to find any good pointers on how i can create a circle if i know the center point and wanted radius in meters on an map in a geographic coordinate system.

I found this class that allows me to create a circular arc with a center point and radius:

Dim pConstCArc As IConstructCircularArc
pConstCArc.ConstructCircle(geometry, circleRadiusValue, True)

But is says that the radius value will take the units of the map. So if i put 1000 for meters that will be assumed to be 1000 degrees. Not quite the same.

If it was a projected coordinate system it would have been easy.

Any advice?

Thank you
Dan
0 Kudos
3 Replies
DarkoRadiceski
Emerging Contributor
After some searching i came accross the IUnitConverter

Did something like this:

        Dim myConverter As IUnitConverter = New UnitConverter()
        Dim datasetUnits As Double = myConverter.ConvertUnits(meters, esriUnits.esriMeters, esriUnits.esriDecimalDegrees)

Would this be the way to go or am i doing it all wrong?
0 Kudos
GuyUrban
Emerging Contributor
If you are still looking. I have VB code as well.

Draw a circle on arcmap using java

    static void drawCircle2(IActiveView activeView) throws Exception
    {
    double Px;
    double Py;
    double Radius;

    IGraphicsContainer graphicsContainer = activeView.getGraphicsContainer();

    // set up the color
    IRgbColor rgbColor = new RgbColor();
    rgbColor.setRed(0);
    rgbColor.setGreen(255);
    rgbColor.setBlue(0);

    IColor color = rgbColor;

    // make the line and define its color, style and width
    ISimpleLineSymbol LineSymbol = new SimpleLineSymbol();
    LineSymbol.setColor(color);
    LineSymbol.setStyle(esriSimpleLineStyle.esriSLSSol id);
    LineSymbol.setWidth(2);

    ISymbol symbol = (ISymbol)LineSymbol;

    //create circle element
    ILineElement pCircleLineElement = new LineElement();
    pCircleLineElement.setSymbol(LineSymbol);
    IElement pCircleElement = (IElement)pCircleLineElement;

    // create point and radius
    Px = 0.0;
    Py = 0.0;
    Radius = 10.0;

    // Create circle geometry
    IPoint centerPoint = new Point();
    centerPoint.putCoords(Px,Py);

    IConstructCircularArc pCircularArc = new CircularArc();

    pCircularArc.constructCircle(centerPoint,Radius,tr ue);


    ISegment Seg = (ISegment)pCircularArc;
    ISegmentCollection SegCollection = new Polyline();
    SegCollection.addSegment(Seg,null,null);

    pCircleElement.setGeometry((IGeometry)SegCollection);

    //add the element to the map and draw it.
    graphicsContainer.addElement(pCircleElement,0);

    activeView.partialRefresh(esriViewDrawPhase.esriVi ewGraphics,null,null);

    }
0 Kudos
HaroonMia
New Contributor
Hi

I am interested in the VB code. How can I get this from you? My email address is miaharoon@yahoo.ca

Gratefully
Haroon

If you are still looking. I have VB code as well.

Draw a circle on arcmap using java

    static void drawCircle2(IActiveView activeView) throws Exception
    {
    double Px;
    double Py;
    double Radius;

    IGraphicsContainer graphicsContainer = activeView.getGraphicsContainer();

    // set up the color
    IRgbColor rgbColor = new RgbColor();
    rgbColor.setRed(0);
    rgbColor.setGreen(255);
    rgbColor.setBlue(0);

    IColor color = rgbColor;

    // make the line and define its color, style and width
    ISimpleLineSymbol LineSymbol = new SimpleLineSymbol();
    LineSymbol.setColor(color);
    LineSymbol.setStyle(esriSimpleLineStyle.esriSLSSol id);
    LineSymbol.setWidth(2);

    ISymbol symbol = (ISymbol)LineSymbol;

    //create circle element
    ILineElement pCircleLineElement = new LineElement();
    pCircleLineElement.setSymbol(LineSymbol);
    IElement pCircleElement = (IElement)pCircleLineElement;

    // create point and radius
    Px = 0.0;
    Py = 0.0;
    Radius = 10.0;

    // Create circle geometry
    IPoint centerPoint = new Point();
    centerPoint.putCoords(Px,Py);

    IConstructCircularArc pCircularArc = new CircularArc();

    pCircularArc.constructCircle(centerPoint,Radius,tr ue);


    ISegment Seg = (ISegment)pCircularArc;
    ISegmentCollection SegCollection = new Polyline();
    SegCollection.addSegment(Seg,null,null);

    pCircleElement.setGeometry((IGeometry)SegCollection);

    //add the element to the map and draw it.
    graphicsContainer.addElement(pCircleElement,0);

    activeView.partialRefresh(esriViewDrawPhase.esriVi ewGraphics,null,null);

    }
0 Kudos