ColumnAggregate()
Summary
Performs a geographic overlay between two layers and aggregates tabular data.
Syntax
ColumnAggregate(string layer_set, real buffer, string source_layer_set, array fields, array options)
| Argument | Contents |
|---|---|
| layer_set | The layer and set into which data are aggregated (the target layer) |
| buffer | The size of the buffer to construct around each feature in layer_set |
| source_layer_set | The layer and selection set from which data are aggregated |
| fields | An array containing one element for each field in the output table. Each element is an array of four items that indicates the statistic calculated, as shown below |
| Element | Type | Contents |
|---|---|---|
| 1 | String | The name of an existing field in the target layer in which the result is stored |
| 2 | String | Statistic: "SUM", "MIN", "MAX", "DOM" (DOMINANT), "AVG" (AVERAGE), "STDDEV" or "COUNT" |
| 3 | String | The name of the source data field in the source layer |
| 4 | String | An optional element indicating a weighting field to use from the source layer |
No options are currently supported.
Notes
-
The COUNT statistic computes the number of features in the source layer that are within or touching the buffer area around the feature in the target layer.
-
The DOM (dominant) statistic chooses any non-missing value from the source layer.
-
The fields in the target layer can include any mappable field.
-
When a row for a source field is null, a missing value is returned.
-
The optional weighting field is used only for the AVG statistic, and ignored for all other statistics.
-
The source layer can be joined to more than one data set, as long as it is a cascading join; for example, if the source layer is A, you can join A to B and then join A+B to C. You cannot join A to B and then A to C (a non-cascading join). Use the source layer name, not the joined view name, when you reference the source layer.
-
The target layer, if it is a joined view, cannot have fields with the same name.
Example
// Before running the example, create a map by opening manh_zip.cdf and add the
// layer manhtrct.cdf, both in the Tutorial folder.
// Then set the working layer to Tract, and use the Dataview-Modify
// Table command to add a field Black of type Real.
ColumnAggregate("Tract|", 0, "5-Digit Zip|", {{"Black", "Sum", "Black", }}, null)
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The aggregation method or other inputs are invalid |
| NotFound | A layer name, set name, or field name is invalid |
See Also
| Function | Summary |
|---|---|
| AggregateTable() | Groups records in a view and computes summary statistics |
| ApplyOverlayTable() | Computes attribute values for a view using information from an overlay table |
| ComputeIntersectionPercentages() | In Intersects two or more area or line layers and computes the intersection percentages |