AnsweredAssumed Answered

How can I permanently remove all graphics from a GraphicsOverlay?

Question asked by ibroad on May 9, 2017
Latest reply on May 10, 2017 by LDanzinger-esristaff

I'm using the PolylineBuilder to, well, create a polyline. I have an "Edit button" that activates editing, and when it's activated another "Cancel button" is shown.

 

That's all working except when I click the "Cancel button", I want to permanently remove the graphics. This works the first time, but when I activate editing again and start to draw another polyline, it shows the previous graphics and continues to draw from the last point.

 

I've tried both:

 

var graphics = spanGraphicsOverlay.graphics;

graphics.clear();
graphics.remove(0, 1);

 

They both clear/remove the graphics on the screen, but the graphics persist when I start creating a new polyline.

 

How would I completely remove the polyline graphic when I cancel the editing?

Outcomes