Select to view content in your preferred language

Dynamic count of points inside a polygon

198
2
Jump to solution
02-12-2025 07:53 AM
wizgis
by
Frequent Contributor

Hi All,

We have the following scenario where there are points coming from survey123 and it is falling inside a polygon.

We wish to know if it's dynamically possible to reflect the count of points inside a polygon in any dashboard element (indicator, etc.). On researching this, we found that by using arcade expression, it is possible to reflect it in the pop-up. Following is the arcade expression that we have set up in the polygon layer

var points = FeatureSetByName($map, 'Point_layer')
var countp = Count(Intersects(points,$feature))
return countp

 

We also found this link to the idea : https://community.esri.com/t5/arcgis-dashboards-ideas/using-custom-attribute-expressions-from-pop-up... , so this makes us think that it is currently not possible. However, data expression has been suggested however, we are not sure what should be the expression.

Any inputs would be helpful.

 

0 Kudos
1 Solution

Accepted Solutions
wizgis
by
Frequent Contributor

@RPGIS 

Thank you for sharing your inputs however, had to modify the expression as Geometry function doesn't take feature set as input. Used the following link for reference: 

View solution in original post

0 Kudos
2 Replies
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @wizgis,

It is possible to do so in Dashboards. You would simply create a new feature set under "Data Expressions" and use the newly created data for any of the needed widgets in the dashboard.

The code below should give you some ideas on how to go about it.

var P = Portal('<portal url>')
var Pnts = FeatureSetByPortalItem( P , '<item id>' , '<layer id>' , '<list of field names>' , True )// layer id is often 0 if the only layer
var Poly = FeatureSetByPortalItem( P , '<item id>' , '<layer id>' , '<list of field names>' , True )// layer id is often 0 if the only layer

var IntPntPoly = Intersects( Geoemtry( Pnts ) , Poly )
var GrpBy = GroupBy(IntPntPoly , '<layer name>', { name: '<custom field name>', expression: '<field name in layer>', statistic: 'COUNT' })
return GrpBy

 

wizgis
by
Frequent Contributor

@RPGIS 

Thank you for sharing your inputs however, had to modify the expression as Geometry function doesn't take feature set as input. Used the following link for reference: 

0 Kudos