Add a circle to graphics layer

690
1
10-07-2010 08:08 AM
AndrewEgleton
New Contributor III
Hi,

Is there an easy way to add a circle of known radius to the graphics layer with out using a geometry service task? I'd like to show a ring 400m from the GPS location, which shouldn't be too hard as the spatial reference is in metres already.

Andy
0 Kudos
1 Reply
DiveshGoyal
Esri Regular Contributor
Unfortunately, no. You can use the GeometryService task to buffer a point by 400 m (or whatever distance you want). This will yield a polygon that looks like a circle.

If you don't want to use the GeometryService, you can use a little trigonometry to find the points along the circle's circumference.

Let r be the radius of the circle. Let (a,b) be the center of the circle. Then to find points (x,y) along the circle :
x = a + r*cos(theta)
y = a + r*sin(theta)

Vary theta from 0 - 360. Use small increments to get a more detailed circle.  Create a polygon with a single ring that contains all these (x,y) pairs. You have a circle.
0 Kudos