Hello Community, I am trying to get the intersection point of a rectangle sketch and points from another graphics layer. How can I get the graphic points which are selected by this rectangle?
Assuming you already have a reference to the GraphicsLayer (graphicsLayer) and the rectangle (geometry) assumed to be a Polygon:
var intersectingFeatures = []; var extent = geometry.extent; graphicsLayer.graphics.forEach(function(graphic) { if (extent.intersects(graphic.geometry)) intersectingFeatures.push(graphic); }); //now do whatever with the intersectingFeatures array
Thank you so much @JoelBennett . It works.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.