kunal.mehta@sap.com

Radius of a circle drawn as a polygon

Discussion created by kunal.mehta@sap.com on Aug 5, 2013
Latest reply on Feb 24, 2016 by akhilcb
All,

I found this solution to draw a circle as a polygon of 360 points:

-(AGSPolygon*) circleWithCenter:(AGSPoint*)point raduis:(double)radius
{
    AGSMutablePolygon * p = [AGSMutablePolygon new];
    [p addRingToPolygon];
    int pointsCount = 360;
    double slice = 2 * M_PI / pointsCount;
    for(int i = 0; i<pointsCount;i++){
        double rad = slice * i;
        double px = point.x + radius * cos(rad);
        double py = point.y + radius * sin(rad);
        [p addPointToRing:[AGSPoint pointWithX:px y:py spatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326]]];
    }
   
    return p;
}


The question I have is what is the units of the radius passed in? For example, if I want to draw a circle of raduis 10 miles, what value do I pass in? If I pass in 10, it just draws a really huge circle with radius several multiples of 10!

I tried to look into the sdk api docs and could not find much info, so any help will be appreciated.

Outcomes