HOW TO

Display a count of different point features in a selected polygon through a pop-up using ArcGIS Arcade in ArcGIS Online

Last Published: August 18, 2023

Summary

In ArcGIS Online, the total number of different point features can be determined in a selected polygon. This provides a visual representation to differentiate the total number of businesses and facilities in a selected region. It also enhances the clarity of information when analyzing the map.

This article provides the workflow to display a count of different point features in a selected polygon through a pop-up using ArcGIS Arcade in ArcGIS Online. In this workflow, Point1, Point2 and Point3 are different point layers while Polygon1 is the polygon layer as shown in the image below.

The polygon and point feature layers in the map

Procedure

  1. In ArcGIS Online Map Viewer, open the web map containing the features.
  2. On the Contents (dark) toolbar, click Layers to open the Layers pane and select the polygon layer with the pop-up intended to be configured.
  3. On the Settings (light) toolbar, click Pop-ups.
  4. In the Pop-ups pane, click Attribute expressions under Options.
  5. In the Attribute expressions pane, click + Add expression.
  6. In the editor window, create a name for the Arcade expression and specify the Arcade expression.
    1. Specify the different point layers. Replace <VariableName1>, <VariableName2>, and <VariableName3> with the point layer names.
var <VariableName1> = FeaturesetByName($datastore, '<VariableName1>')

var <VariableName2> = FeaturesetByName($datastore,'<VariableName2>')

var <VariableName3> = FeaturesetByName($datastore,'<VariableName3>')
  1. Return the total number of counts of the different point features intersecting the polygon layer.
return Concatenate([
 `Point1: ${Count(Intersects($feature, Point1))}`,
 `Point2: ${Count(Intersects($feature, Point2))}`,
 `Point3: ${Count(Intersects($feature, Point3))}`,
], TextFormatting.Newline)
The code below shows the example of the full working script.
var Point1 = FeaturesetByName($datastore, 'Point1')

var Point2 = FeaturesetByName($datastore,'Point2')

var Point3 = FeaturesetByName($datastore,'Point3')

return Concatenate([
 `Point1: ${Count(Intersects($feature, Point1))}`,
 `Point2: ${Count(Intersects($feature, Point2))}`,
 `Point3: ${Count(Intersects($feature, Point3))}`,
], TextFormatting.Newline)
The image below shows the example of the full working script.
The example of the full working script
  1. Click Done.
  1. In the Attribute expressions pane, click the Previous The Previous icon button above the newly created Arcade expression.
  2. In the Pop-ups pane, click Fields list > Select fields.
  3. Under Expressions, select the newly created Arcade expression and click Done.

The image below shows the count of different point features in a selected polygon through a pop-up.

The total count of the different point features intersecting the polygon layer

Article ID: 000029218

Software:
  • ArcGIS Online

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