HOW TO
In Portal for ArcGIS Map Viewer Classic, Arcade expressions can be used to format the text displayed in a pop-up according to the specifications applied. This article provides an example and instructions using the Arcade expressions to display the sum of intersecting features for pop-ups in Portal for ArcGIS Map Viewer Classic.
The workflow provided utilizes the Arcade functions listed in the table below to display the sum of point features within the polygon features in Portal for ArcGIS Map Viewer pop-ups.
Arcade Function | Attribute Result |
---|---|
Count(features) | Returns the number of features in a layer. |
Intersects(features, inputGeometry) | Returns features from a FeatureSet that intersects another geometry. |
FeatureSetByName(featureSetCollection, title) | Creates a FeatureSet from a Feature Layer based on its name within a map or feature service. |
Round(value, numberOfDecimalPlaces) | Returns the input value, rounded to the given number of decimal places. |
AreaGeodetic(features, unitOfMeasurement) | Returns the geodetic area of the feature in the given units. |
Filter(features, sqlExpression) | Filters features using an SQL92 expression. |
Text(value, 'format') | Converts the argument into a string and optionally formats it. |
var <variableName> = Count(Intersects(FeatureSetByName($map, "<layerName>"), $feature))
var <variableName1> = Round(TreesCount / AreaGeodetic($feature, '<unitOfMeasurement>'), <numberOfDecimalPlaces>)
var <variableName2> = Count(Intersects(Filter(FeatureSetByName($map, "<layerName>"), "<fieldName> LIKE '%<fieldValue>%'"), $feature))
var <variableName3> = "<text> " + $feature["fieldName1"] + " <text1> " + Text(<variableName>, '<format>') + " <text2> " + Text(<variableName1>, '<format>') + " <text3> " + Text(<variableName2>, '<format>') + " <text4>" return <variableName3>
The following code block demonstrates the full working Arcade expressions.
var treesCount = Count(Intersects(FeatureSetByName($map, "Street Tree Data WGS84"), $feature)) var treeDensity = Round(TreesCount / AreaGeodetic($feature, 'square-kilometers'), 0) var mapleTreesCount = Count(Intersects(Filter(FeatureSetByName($map, "Street Tree Data WGS84"), "COMMON_NAM LIKE '%MAPLE%'"), $feature)) var popupDisplay = "The neighbourhood of " + $feature["AREA_NAME"] + " has a total of " + Text(treesCount, '#,###') + " street trees making for " + Text(treeDensity, '#,###') + " trees per SQ KM. Of those trees, " + Text(mapleTreesCount, '#,###') + " of them are part of the Maple tree family." return popupDisplay
The image below shows the configured pop-up with the information on the total number of trees, and the number of Maple trees for each polygon feature displayed.
Article ID: 000028155
Get help from ArcGIS experts
Download the Esri Support App