The Aggregate Points task summarizes point features within designated areas. The tool calculates the total number of points within each bounding area, as well as any specified statistics for the points within the bounding areas.
For example, if the points represent coffee shops and each point has a TOTAL attribute, you can get statistics such as the sum of all sales within the polygon, the minimum or maximum TOTAL value, or the standard deviation of all sales within the polygon.
Request URL
https://<analysis url>/AggregatePoints/submitJobRequest parameters
| Name | Required | Type | Default | Description |
|---|---|---|---|---|
pointLayer |
| feature | The point features that will be aggregated. | |
polygonLayer |
| feature | The polygon features (areas) into which the input points will be aggregated. | |
keepBoundariesWithNoPoints |
| boolean | true | Specifies which polygons will be included in the result layer. |
summaryFields |
| string | A list of field names and statistical summary types that will be calculated. | |
groupByField |
| string | A categorical field that creates groups for statistical calculations. | |
minorityMajority |
| boolean | false | Returns the minority and majority groups in the output. |
percentPoints |
| boolean | false | Returns the percent of points in the minority and majority groups. |
outputName |
| string | The name of the output feature service. | |
context |
| string | The extent and output spatial reference environments. | |
binType |
| string | Square | The shape of the bins used to aggregate the input points. |
binSize |
| double | The distance used to calculate the size of the bins. | |
binSizeUnit |
| string | Meters | The linear unit to be used with the distance value specified in |
f |
| string | html | The response format. |
Required
Sometimes required
Optional
pointLayer
feature | required
The point features that will be aggregated into polygons in the polygon parameter or the specified bins.
Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:
- A URL to a feature service layer with an optional filter to select specific features
- A feature collection
Examples:
{"url": <feature service layer url >, "filter" : <where clause >} {"layerDefinition" : {}, "feature Set" : {}, "filter" : <where clause >}
polygonLayer
feature | sometimes required
The polygon features (areas) into which the input points will be aggregated. The polygon parameter is required unless a value for the bin parameter is specified.
Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:
- A URL to a feature service layer with an optional filter to select specific features
- A feature collection
keepBoundariesWithNoPoints
Boolean | optional
Default value: true
Accepted values: true | false
Specifies whether the polygons that have no points within them will be returned in the output. If true, all generated bins or input polygons will be returned, including those that do not overlap input points. If false, bins or polygons with no summarized points will be removed from the output.
summaryFields
string | optional
A list of field names and statistical summary types that will be calculated for all points within each polygon. The count of points within each polygon is always returned.
Syntax: ["field
field is one of the numeric or date fields in the input point parameter.
summary is one of the following:
Sum—Adds the total value of all the points in each polygon.Mean—Calculates the average of all the points in each polygon.Min—Finds the smallest value of all the points in each polygon.Max—Finds the largest value of all the points in each polygon.Stddev—Finds the standard deviation of all the points in each polygon.
Example: "summary
groupByField
string | optional
A field name in the point. Points that have the same value for the group by field will have their own counts and summary field statistics.
You can create statistical groups using an attribute in the analysis layer. For example, if you are aggregating crimes to neighborhood boundaries, you may have a Crime attribute with five crime types. Each unique crime type forms a group, and the statistics you choose will be calculated for each unique value of Crime.
Example: "group
When group is provided, two results are created: the result layer and a related group table containing the statistics.
minorityMajority
Boolean | optional
Default value: false
Accepted values: true | false
This Boolean parameter is applicable only when a group value is specified. If true, the minority (least dominant) or the majority (most dominant) attribute values for each group field within each boundary are calculated. Two new fields are added to aggregated prefixed with Majority and Minority.
percentPoints
Boolean | optional
Default value: false
Accepted values: true | false
This Boolean parameter is applicable only when a group value is specified. If true, the percentage count of points for each unique group value is calculated. A new field is added to the group output table containing the percentages of each attribute value within each group. If minority is true, two additional fields are added to aggregated containing the percentages of the minority and majority attribute values within each group.
outputName
string | optional
The name of the output layer.
If provided, the task will create a feature service of the results. You define the name of the service. If an output value is not provided, the task will return a feature collection.
Syntax:
{
"serviceProperties": {
"name": "featureServiceName"
}
}You can overwrite an existing feature service by providing the item, service, or name value of the existing feature service and setting the overwrite property to true. Including the service parameter is optional. As described in the Feature output topic, you must either be the owner of the feature service or have administrative privileges to perform the overwrite.
{
"itemProperties": {
"itemId": "52d34e7598e7484188228xxxxxx",
"overwrite": true
}
}context
string | optional
The Context parameter contains the following additional settings that affect task operation:
- Extent (
extent)—A bounding box that defines the analysis area. Only input features that intersect the bounding box will be analyzed. - Output spatial reference (
out)—The output features will be projected into the output spatial reference.SR
Syntax:
{
"extent" : {extent},
"outSR" : {spatial reference}
}binType
string | optional
Default value: Square
Accepted values: Hexagon | Square
The type of bin that will be generated and points will be aggregated into. Bin options are as follows:
HexagonSquare—This is the default.
Example: "bin
When generating bins, for Square, the number and units specified determine the height and length of the square. For Hexagon, the number and units specified determine the distance between parallel sides.
Either bin or polygon must be specified. If bin is chosen, bin and bin specifying the size of the bins must be included.
binSize
double | sometimes required
The distance used to calculate the size of the bins specified in the bin parameter that the point will be aggregated into. This parameter is required if bin is used.
Example: "bin
binSizeUnit
string | sometimes required
Default value: Meters
Accepted values: Meters | Kilometers | Feet | Miles | Nautical | Yards
The linear unit to be used with the distance value specified in bin. This parameter is required if bin is used.
Example: "bin
Response
When you submit a request, the service assigns a unique job ID for the transaction.
Syntax:
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}After the initial request is submitted, you can use the job to periodically check the status of the job and messages, as described in Check job status. Once the job has successfully completed, you use the job to retrieve the results. To track the status, you can make a request of the following form:
https://<analysis url>/AggregatePoints/jobs/<jobId>Accessing results
When the status of the job request is esri, you can access the results of the analysis by making a request of the following form:
https://<analysis url>/AggregatePoints/jobs/<jobId>/results/<output parameter name>?token=<your token>&f=jsonThe following options are available for <output parameter name:
aggregated—A required output containing polygon features.Layer group—An optional table output.Summary groupis only created if theSummary groupparameter is specified.By Field
aggregatedLayer
features | required
aggregated will always contain polygon features. It may have the same number of or fewer polygon features than the input polygon layer, based on the value of keep.
Fields
The layer will inherit all the attributes of the input polygon layer and will have a Point attribute that is the number of points enclosed by the polygon.
If a summary parameter value is specified in the task request, the layer will have additional attributes for each requested summary. For example, if you request the following:
"summary
The result polygon features will have two attributes, Sum and Mean, to contain the calculated values.
Request example
{"url":"https://<analysis url>/AggregatePoints/jobs/<jobId>/results/aggregatedLayer"}The result has properties for parameter name, data type, and value. The contents of value depend on the output parameter value provided in the initial request.
If output is provided, value contains the URL to the feature service layer as follows:
{
"paramName":"aggregatedLayer",
"dataType":"GPString",
"value":{"url":"<hosted feature service layer url>"}
}See Feature output for more information about how the result layer or collection is accessed.
groupSummary
table | optional
If the group parameter is specified, an optional group summary table is created. The group summary table provides the count of points and other summary fields for each group of points for each polygon boundaries in the polygon layer. Tables are a subset of features; that is, they contain attributes but no geometry.
Fields
The output table will have the following fields:
Join—The object ID of the input_ID polygon.Layer groupBy Field Point—The count of points within the group._Count _<group By Field name > - Fields based on the
summaryparameter in the task request. The summary attribute name will be of typeFields <summary type. For example, if you specify>_<fieldname > "summaryin the task request, a correspondingFields" : [" Annual _Sales Max"] Maxattribute will be included in the table to present the maximum annual sales for each group in each polygon area._Annual _Sales
Request example
{"url":"https://<analysis url>/AggregatePoints/jobs/<jobId>/results/groupSummary"}The result has properties for parameter name, data type, and value. The contents of value depend on the output parameter value provided in the initial request.
If output is provided, value contains the URL to the feature service layer as follows:
{
"paramName":"groupSummary",
"dataType":"GPString",
"value":{"url":"<hosted feature service table url>"}
}See Feature output for more information about how the group summary table is accessed.
Licensing
This task requires the following user type and configurations:
- Creator, Professional, or Professional Plus user type
- Publisher, Facilitator, or Administrator role, or an equivalent custom role