Best way to show points in polygons in Dashboard?

140
4
Jump to solution
01-27-2022 06:06 AM
Labels (2)
Sil_
by
New Contributor III

Hi.

How can I show number of tree points per neighborhood in Dashboard?

I have these two layers:

  1. Point layer for tree points, an editable layer that is crowdsourced through Survey123, with sync enabled
  2. Polygon layer for neighborhoods (18 in total), this is a static layer

Here's what I've tried so far:

  • Calculate field for the neighborhood layer using Arcade, count and intersect function. This gives the right result, but is not so great because the tree point layer is constantly updated and I believe I have to update this manually every time a new tree point is added to the point layer (?)
  • Setting up a Data expression in a List in the dashboard, but I cannot get this to work. This is the expression I have tried:
    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
  • Including name of neighborhood already when the tree points are added using javascript to set up pulldata in Survey123 Connect, but this seems like a tall mountain to climb.

I am grateful for any tips or pointers.

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Frequent Contributor

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.

 

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
4 Replies
jcarlson
MVP Frequent Contributor

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.

 

- Josh Carlson
Kendall County GIS
0 Kudos
Sil_
by
New Contributor III

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?

0 Kudos
jcarlson
MVP Frequent Contributor

You can certainly use this in the popup as well, though you could simplify it quite a bit since the popup is per-feature.

- Josh Carlson
Kendall County GIS
0 Kudos
Sil_
by
New Contributor III

Great!

Thanks again @jcarlson 

0 Kudos