Aggregate Field

Since version: 1.17

The Aggregate Field profile allows the map author to write an expression that executes for all features aggregated to clusters or bins. The result of the expression for each feature will be aggregated based on an indicated statistic type (e.g. sum, average, min, max, mode).

The resulting aggregate field could be used for displaying data in an aggregate feature's popup, label, or renderer. When the aggregate feature is to be drawn, the script will execute for all aggregated features. It is expected that the script returns either a text value or a number.

Context

The following products implement this profile:

Spatial reference

The spatial reference of the map in which the expression executes determines the execution context's spatial reference.

Time zone

The time zone of the map in which the expression executes determines the execution context's default time zone.

Profile variables

Variable NameTypeDescription
$featureFeatureAn individual feature included in an aggregate feature. This provides access to all field attributes of the feature.

Function bundles

Core | Geometry

Return types

Text | Number

Examples

Calculates the average age of features within each bin

Use dark colors for code blocksCopy
1
DateDiff($feature.Completed, $feature.Submitted, 'days');

Calculates the predominant political party within each bin

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
var republican = $feature.MP06025a_B;
var democrat = $feature.MP06024a_B;
var independent = $feature.MP06026a_B;
var parties = [republican, democrat, independent];

return Decode( Max(parties),
  republican, 'republican',
  democrat, 'democrat',
  independent, 'independent',
  'n/a'
);

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.