Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am able to draw the circle but I want a circle of radius 3 kms

I have checked all the previous posts.

I want to know what is the units of radius in the below code.

var radius, circle, ring, pts, angle;
var currentPoint = new esri.geometry.Point(longitude, latitude, this.parent.esriMap.spatialReference);

currentPoint = esri.geometry.geographicToWebMercator(currentPoint);
circle = new esri.geometry.Polygon(this.parent.esriMap.spatialReference);

ring = []; // point that make up the circle 
pts = 40; // number of points on the circle 
angle = 360 / pts; // used to compute points on the circle 

for (var i = 0; i <= 360; i = i + 10) {
    var radian = i * (Math.PI / 180.0);
    var x1= radius * Math.cos(radian);
    var y1= radius * Math.sin(radian);
    var circlePoint = new esri.geometry.Point(x1, y1, this.parent.esriMap.spatialReference);
    circlePoint = esri.geometry.geographicToWebMercator(circlePoint);

    points[i] = new esri.geometry.Point(
        parseFloat(circlePoint.x) + parseFloat(currentPoint.x), parseFloat(circlePoint.y) + parseFloat(currentPoint.y),
//rest code to add the layers to map
share|improve this question
do you wish to do this using programming or manually in ArcMap? –  vinayan Aug 20 '14 at 7:15
there is not much I can say from the code you provided. I don't see where radius is initialised. You say "var radius = radius * Math.cos(radian); But radius should still be null at this point. Further I don't see where the radius goes in the point calculation for your circle. Where do the point parameters (x1, y1) come from? –  Chris P Aug 20 '14 at 11:45
Given that the ground will not be flat, what do you mean by a 3km radius? –  Ian Aug 20 '14 at 12:07
Sorry for the errors,I have corrected the code.I want to know what value i have to give for radius so that i can draw a circle with radius as 3 kms.To explain the 3 kms-let me take an example,lets consider a chemical factory on earth and within three kms there is a residential building.This building is at risk.I want to depict the same on the Map.I want to draw a circle of 3 kms radius around the chemical factory to intimate the users. –  user36020 Aug 27 '14 at 10:19

2 Answers 2

Creating a 3km radius circle is quite easy in ArcGIS:

  1. Create a point featureclass marking the center of your area of interest.
  2. Use the Buffer (Analysis) tool to create the 3km radius buffer around the point featureclass.

enter image description here

share|improve this answer

When solving it programmatically I would start with this Snippet from ESRI:

Create Graphic Buffers around Selected Features Snippet:

///<summary>Draws graphic buffers around the selected features in the map using distance units specified.</summary>
///<param name="activeView">An IActiveView interface.</param>
///<param name="distance">A System.Double that is the distance in map units around the select features to draw a graphic buffer. Example: 10</param>
public void CreateGraphicBuffersAroundSelectedFeatures(ESRI.ArcGIS.Carto.IActiveView activeView, System.Double distance)
  //parameter check
  if (activeView == null || distance < 0)
  ESRI.ArcGIS.Carto.IMap map = activeView.FocusMap;
  // Clear any previous buffers from the screen
  ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = (ESRI.ArcGIS.Carto.IGraphicsContainer)map; // Explicit Cast

  // Verify there is a feature(s) selected
  if (map.SelectionCount == 0)

  // Reset to the first selected feature
  ESRI.ArcGIS.Geodatabase.IEnumFeature enumFeature = (ESRI.ArcGIS.Geodatabase.IEnumFeature)map.FeatureSelection; // Explicit Cast
  ESRI.ArcGIS.Geodatabase.IFeature feature = enumFeature.Next();

  // Buffer all the selected features by the buffer distance and create a new polygon element from each result
  ESRI.ArcGIS.Geometry.ITopologicalOperator topologicalOperator;
  ESRI.ArcGIS.Carto.IElement element;
  while (!(feature == null))
    topologicalOperator = (ESRI.ArcGIS.Geometry.ITopologicalOperator)feature.Shape; // Explicit Cast
    element = new ESRI.ArcGIS.Carto.PolygonElementClass();
    element.Geometry = topologicalOperator.Buffer(distance);
    graphicsContainer.AddElement(element, 0);
    feature = enumFeature.Next();

  activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGraphics, null, null);

available at:

this takes a feature point geometry as input but you could create your own geometry with the coordinates of the buffer you want to draw. The distance is in map units but following site might help you get the relation to the geographic distance:

ArcGis Desktop Help: About setting distance units

share|improve this answer
Thank you so much for the very quick reply.Actually I am very new to arcgis and esri related programming.I am yet to get the basics right.I have pasted the code I have which draws a circle.I want to draw a circle of 3 kms.Hence I set the var radius=3000 as mentioned in the arcgis site.But it drew many polygons.Please help me in the getting the radius converted from kilometers to the required units. –  user36020 Aug 20 '14 at 9:30
var pt = new Point(long,lat,wkid); pt = geographicToWebMercator(pt), circle = new Polygon(); ring = []; pts = 40; angle = 360 / pts; for(var i = 1; i <= pts; i++) { var radians = i * angle * Math.PI / 180; ring.push([pt.x + RADIUS* Math.cos(radians), pt.y + RADIUS* Math.sin(radians)]); } ring.push(ring[0]); circle.addRing(ring); esri.Graphic(circle, sym)); –  user36020 Aug 20 '14 at 9:34
when adding code please modify your original post. Code in the comment is hard to read. –  Chris P Aug 20 '14 at 9:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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