HOW TO

Display the counts of point features within polygon features using Arcade in ArcGIS Dashboards

Last Published: April 2, 2025

Summary

In ArcGIS Dashboards, Arcade expressions can efficiently calculate and display the count of point features within polygon features using the Indicator element. This method enhances spatial analysis and streamlines the workflow without the need for complex data processing and is demonstrated in this article. The dashboard below shows the point and polygon features.

Point features and polygons in a dashboard

Procedure

  1. In ArcGIS Dashboards, add the Map element to the dashboard and select the web map. Refer to ArcGIS Dashboards: Add elements for instructions.
  2. Click View View icon on the dashboard toolbar. On the Body tab, click + Add Element and select Indicator.
Indicator element in the dashboard
  1. In the Select a layer window, under Data expressions, click New data expression.
Data expression in the Indicator element
  1. In the Edit data expression window, specify the Arcade expression below and replace the following:
    1. <portal_URL> with the URL of the desired portal,
    2. <pointlayer_id> with the ID of the point feature layer,
    3. <polygonlayer_id> with the ID of the polygon feature layer, and
    4. <field_name> with the desired field name.
var p = Portal('<portal_URL>');
var point_layer = FeatureSetByPortalItem(p, '<pointlayer_id>');
var poly_layer = FeatureSetByPortalItem(p, '<polygonlayer_id>');

var OutputDict = { 
 'fields': [{ 'name': '<field_name>', 'type': 'esriFieldTypeString'},
 {'name': 'f_count','type': 'esriFieldTypeInteger'}], 
 'geometryType': '',  
 'features': []}; 

var index = 0;
var num_points_intersecting;
for (var f in poly_layer) {
   Console(f["name"])
   num_points_intersecting = Count(Intersects(f, point_layer));
   Console(num_points_intersecting)
   OutputDict.features[index] = {  
           'attributes': {  
               'name': f['name'],   
               'f_count': num_points_intersecting
           }
       }
   Console(OutputDict.features[index]);
   index++;
}
Console(OutputDict);

var dict_text = Text(OutputDict);
Console(dict_text);

var mydict = FeatureSet(dict_text);
Console(mydict);

return mydict;

The image shows the full working script.

Full working script in the dashboard
  1. In the Edit data expression window, click Done.
  2. In the Indicator window, on the Data tab, in the Data options pane, under Settings, set the configurations below.
    1. For Value type, click Feature.
    2. For Value field, select f_count.
The value type and field of the Indicator element
  1. For Filter, click +Filter.
  2. Click the Field for the condition drop-down menu and select the field name.
  3. Click the Enter a value drop-down menu and select the name.
The filter in the Indicator element
  1. In the Indicator window, click the Indicator tab.
  2. In the Indicator options pane, under Settings, in the Top text section, click Insert Insert icon and under Field values, click the desired field name.
Configuring the top text of the Indicator element
  1. In the Indicator window, click Done.
  2. Repeat Step 2 to add additional Indicator elements. In the Select a layer window, under Data expression, select the added data expression.
The added data expression in the Indicator element
  1. Repeat Steps 6 through 9 to configure the Indicator element.
  1. Click Save Save icon > Save on the dashboard toolbar.

The dashboard shows the point feature counts of each polygon using the Indicator element.

The point feature counts of each polygon displayed in Indicator elements

Article ID: 000031381

Software:
  • ArcGIS Online
  • Portal for ArcGIS
  • ArcGIS Enterprise
  • ArcGIS Dashboards

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options