I am working in ArcGIS Online and need to show the point feature count in a polygon layer with multiple features. I found a way to show the count, but it's not too meaningful yet: I need help iterating over the polygon features. Do you know how I can iterate over the polygon features by say fieldname1?
var p = Portal("https://name.maps.arcgis.com");
// Point feature is incidents
var incidents = FeatureSetByPortalItem(p, "123rty", 0);
// Polygon feature is divisions
var divisions = FeatureSetByPortalItem(p, "abc123", 0);
// Iterate over divisions FeatureSet and get intersected incidents for each
for(var d in divisions) {
var inc_count = Count(Intersects(d, incidents))
Console('There are currently ' + inc_count + ' incidents in ')
Where are you using this expression? Is it for a Dashboard? Beyond the count, what else are you looking to show?
I'm using this expression in a label. It's in a map used in an Experience Builder. There's more fancy stuff I think about, but this is just to start.