Select to view content in your preferred language

ArcGIS JavaScript: delete all graphics that intersect a polygon?

3388
2
Jump to solution
11-08-2014 06:58 PM
JerryGarcia
Frequent Contributor

How do you manage graphics with the ArcGIS JavaScript API?

Specifically,  I want to delete all graphics that intersect a polygon.  How do I do that?

I have graphics in Feature Layers.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Jerry,

   You would loop through the Graphics Layers graphics to see if the graphics.geometry is contained in the test polygon. Polygon class has a contain method that take a geometry as a parameter. If the polygon contains the geometry then you use the GraphicsLayers.remove method that take a graphics as its parameter. Hope this helps.

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Jerry,

   You would loop through the Graphics Layers graphics to see if the graphics.geometry is contained in the test polygon. Polygon class has a contain method that take a geometry as a parameter. If the polygon contains the geometry then you use the GraphicsLayers.remove method that take a graphics as its parameter. Hope this helps.

0 Kudos
BatbayarJargalsaikhan1
Emerging Contributor

Robert,

is there any sample regarding graphic overlap checking...?!

thanks,

0 Kudos