Select to view content in your preferred language

count feature inside arbitratry polygon

300
2
07-10-2024 11:43 PM
yockee
by
Frequent Contributor

I want to make a simple webgis apps using JS where I can select some points using arbitrary polygon. Once polygon is drawn, there is a popup showing how many points fall inside it. 

Further more, I need to be able to pass this count into another app.

I have prepared:

- 2 Feature services, one being polygon and the other on point

Can anyone show me some directions ? What spatial analysis is needed for this ? Possibly intersect right ?

0 Kudos
2 Replies
AnneFitz
Esri Regular Contributor

Hi @yockee - check out this sample Select features by rectangle. It allows you to draw a polygon on the map, and then query for features that intersect that polygon by setting the query's geometry property.

Once you get the resulting featureSet from the query, you can open the popup like so: 

view.openPopup({
  location: point, // point geometry for where you want the popup to open
  features: queryResults.features // features returned from the query
});
yockee
by
Frequent Contributor

Where in the codes i should insert these "view.openpopup" lines .. thanks

0 Kudos