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 Name | Type | Description |
---|---|---|
$feature | Feature | An individual feature included in an aggregate feature. This provides access to all field attributes of the feature. |
Function bundles
Return types
Examples
Calculates the average age of features within each bin
DateDiff($feature.Completed, $feature.Submitted, 'days');
Calculates the predominant political party within each bin
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'
);