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.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.