Hi.
How can I show number of tree points per neighborhood in Dashboard?
I have these two layers:
Here's what I've tried so far:
var trees = FeatureSetByPortalItem( Portal('https://www.arcgis.com'), '3f225e2cadf14c9f644j72sf0d862fc3', 0, ['Name', 'Count'], false )
var neighborhood = FeatureSetByPortalItem( Portal('https://www.arcgis.com'), '00de4f987654332159ee8326d8bb9150b', 0, ['Name', 'Count'], false )
var countTrees = Count(Intersects(trees,neighborhood))
return countTrees
I am grateful for any tips or pointers.
Solved! Go to Solution.
Data Expressions are probably the right way to go, but they need to output a FeatureSet. If I can toot my own horn, I recently contributed a new example to the Dashboard Data section of Esri's Arcade Github: https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/SpatialAggregation.md
That example does exactly what you're attempting, returning a summary of points within a polygon layer. You should be able to swap in your own layers and variable names easily enough.
Data Expressions are probably the right way to go, but they need to output a FeatureSet. If I can toot my own horn, I recently contributed a new example to the Dashboard Data section of Esri's Arcade Github: https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/SpatialAggregation.md
That example does exactly what you're attempting, returning a summary of points within a polygon layer. You should be able to swap in your own layers and variable names easily enough.
Thank you @jcarlson! This works great!
I even see now that you suggested this as a solution when I asked a similar question some weeks ago, but I couldn't wrap my head around it at the time.
For the point count to be reflected in the web map that is shown in the dashboard, would it work to use this expression on the popup settings in the web map?
You can certainly use this in the popup as well, though you could simplify it quite a bit since the popup is per-feature.