0

I would need to update the radius of existing circle object in esri/geometry/Circle.

I've tried this code but doesn't work as expected.

var radiusSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
        new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASHDOT, new Color([255, 223, 71]), 2)
        ,new Color([255,255,0,0.25])
      );

var pointX = new Point({
            longitude: X.longitude,
            latitude: X.latitude
        });
var circle = new Circle(
            pointX,
            {       
                geodesic: true,
                radius: 2,
                radiusUnit: units.METERS
            });

var graphicRadius = new Graphic(circle, radiusSymbol);
map.graphics.add(graphicRadius);

Whenever new radius value and new lat&long are received, I need to update the circle with new radius value.

 var newCircle = new Circle(
         newPoint,
            {       
            geodesic: true,
            radius: newRadius,
            radiusUnit: units.METERS
            });

    graphicRadius = new Graphic(newCircle, radiusSymbol);
    graphicRadius.setGeometry(newPoint);

It's not throwing errors but the circle is getting disappeared.

I hope there is setRadius method to use but it seems either I don't know how or not exist.


solved with graphicRadius.setGeometry(newCircle ,radiusSymbol);

closed as off-topic by PolyGeo Nov 27 '16 at 21:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

1

The language you are using to try to do this does not appear to be ArcPy.

Here's a solution for JavaScript 4.x (using this sample)

  var circle = new Circle({
    center: point,
    geodesic: true,
    radius: 200000,
    radiusUnit: "meters"
  });

  var circleGraphic = new Graphic({
    geometry: circle,
    symbol: fillSymbol
  });
  • Thanks Kenbuja for the comment but I don't have an issue on creating circle. I would like to know how to update the existing circle with new radius value. Let say there are 5 circles with 2 meters radius on my current map. I am receiving new radius value for some of existing circle via web socket. Whenever I tried to update the circle (newCircle and newRadius on my above source code) those circle gets disappeared from the map while the other circles remains. – Julia Nov 27 '16 at 13:32

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