Creating Popups using Arcade
Overview:
In ArcGIS Online you can enhance map feature interactivity by creating popups. This article will show you how to create popups using ESRI's Arcade language.
Why use Arcade?:
- Because of its portability with other apps across the ArcGIS system
- It allows you to perform calculations on feature attributes
- With Arcade you can format and display data conditionally
- Arcade allows you to combine and transform attribute values
- With Arcade you can create dynamic text and visuals
Let's Begin:
- Open a web browser and go to https://www.arcgis.com/
- If prompted to do so, Sign In
- Select Layers
- Click the dropdown on the Add layers button and choose Add Layer from URL and paste in this URL https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_2020_DHC_Race_and_Ethnicity/FeatureServer
Expand the 2020 Census Layer and select/click on Block Group:
On the right hand side of the map click on Pop-ups:
Click on Attribute expressions:
Click + Add expression
On the top line enter the title/descriptor for your expression, I entered Native Americans.
Under run, to the right of 1 enter $feature - ESRI will aid you in typing showing options so you can simply type $f and it will show $feature, pressing enter will insert the text $feature. $feature represents the clicked on feature (of the Bock Group Layer) for the popup. After $feature type . and again ESRI will aid you, showing all the attributes you can pick from, I selected/ClickedOn "American Indian and Alaska Native alone, not Hispanic or Latino". ESRI replaced the field name alias with it's internal field name, resulting in: $feature.P0090007. To see a list of the actual, not alias, field names you can view the fields here https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Census_2020_DHC_Race_and_Ethnicity/FeatureServer/4
If you click the Run button, at the bottom half of the form it will show output and the data type of the field attribute and it's value, something like number: 4.
Click Done at the bottom right of the form to save your Expression.
Now that you have added an expression, click the back < arrow.
Under Fields List click on Select Fields. Click on the Select all button:
After clicking the Select all button changes to Deselect all, click on Deselect all.
At the top you will see Expressions (including the 1 you just created) and below that Fields. Select/Check the expression you just created:
Click the Done button at the bottom of the form.
Now test that your created expression pops up in the field list when you click on a block:
Now would be a great time to Save your Map:
If you want to dive deeper in the next Knowledge Base article in this series, Performing Calculations in Arcade.