d.sokolov

Draw a circle with radius in meters

Discussion created by d.sokolov on Sep 20, 2013
Latest reply on Sep 30, 2013 by doneill-esristaff
Hi

I need to draw a circle on GraphicsLayer layer with given center and given radius in meters. So me method looks like this:

 private Polygon drawCircle(Point center, double radius, int pointsCount) {
  double r = convertFromMeters(radius); //I don't know how to convert from meters
  Polygon p = new Polygon();
  boolean started = false;
  double slice = 2 * Math.PI / pointsCount;
  for (int i = 0; i <= pointsCount; i++) {
   double rad = slice * i;
   double px = center.getX() + r * Math.cos(rad);
   double py = center.getY() + r * Math.sin(rad);
   Point point = new Point(px, py);
   if (started) {
    p.lineTo(point);
   } else {
    p.startPath(point);
    started = true;
   }
  }
  return p;
 }


Could anyone help me, how to convert from meters to suitable units?
Thanks.

Outcomes