Skip To Content
ArcGIS Developer
Dashboard

Summarize Attributes

Description

Summarize Attributes

The SummarizeAttributes operation takes an input layer and summarizes and calculates statistics for like values. The most basic statistic is the count of features with a specified value, but other statistics can be calculated as well. You can also summarize values into time steps.

For example, if you have a point layer of store locations with a field representing the DISTRICT_MANAGER_NAME and you want to summarize coffee sales by manager, you can specify the DISTRICT_MANAGER_NAME field as the field to dissolve on, and all rows of data representing individual managers will be summarized. This means all store locations managed by Manager1 will be summarized into one row with summary statistics calculated. In this instance, statistics such as the number of stores and the sum of TOTAL_SALES for all stores that Manager1 manages will be calculated as well as for any other manager listed in the DISTRICT_MANAGER_NAME field.

Request parameters

ParameterDetails
inputLayer

(Required)

The features that will be summarized.

Syntax: As described in Feature input, this parameter can be one of the following:

  • A URL to a feature service layer with an optional filter to select specific features
  • A URL to a big data catalog service layer with an optional filter to select specific features
  • A feature collection

REST examples

//REST web example
{"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0", "filter": "Month = 'September'"}

//REST scripting example
"inputLayer": {"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0", "filter": "Month = 'September'"}
fields

(Required)

The fields that will be used to summarize like features. For example, if you choose a field named property type with the values of commercial and residential, all the features with property type residential will be summarized together through calculated summary statistics and all of the commercial features will be summarized together the same way.

Note:

[] will group all features into one summary feature.

REST examples

//REST web example
property type, county

//REST scripting example
"field": "property type, county"
timeStepInterval

(Optional)

A numeric value that specifies duration of the time step interval. The default is none. This option is only available if the input points are time enabled and represent an instant in time.

This parameter is available at ArcGIS Enterprise 10.9.

REST example

//REST web example
20

//REST scripting example
"timeStepInterval": 20
timeStepIntervalUnit

(Optional)

A string that specifies units of the time step interval. The default is none. This option is only available if the input points are time enabled and represent an instant in time.

This parameter is available at ArcGIS Enterprise 10.9.

REST examples

//REST web example
Minutes

//REST scripting example
"timeStepIntervalUnit": "Minutes"
timeStepRepeatInterval

(Optional)

A numeric value that specifies how often the time step repeat occurs. The default is none. This option is only available if the input points are time enabled and of time type instant.

This parameter is available at ArcGIS Enterprise 10.9.

REST examples

//REST web example
1

//REST scripting example
"timeStepRepeatInterval": 1
timeStepRepeatIntervalUnit

(Optional)

A string that specifies the temporal unit of the step repeat. The default is none. This option is only available if the input points are time enabled and of time type instant.

This parameter is available at ArcGIS Enterprise 10.9.

REST Examples

//REST web example
Hours

//REST scripting example
"timeStepRepeatIntervalUnit": "Hours"
timeStepReference

(Optional)

A date that specifies the reference time to align the time slices to, represented in milliseconds from epoch. The default is January 1, 1970, at 12:00 a.m. (epoch time stamp 0). This option is only available if the input points are time enabled and of time type instant.

This parameter is available at ArcGIS Enterprise 10.9.

REST examples

//REST web example
946684800000

//REST scripting example
"timeStepReference": 946684800000
summaryFields

(Optional)

A list of field names and statistical summary types you want to calculate. Note that the count is always returned. By default, all statistics are returned.

The Count of features with the same fields values are always returned.

onStatisticField specifies the name of the fields in the target layer. statisticType is one of the following for numeric fields:

  • Count—For numeric fields, this totals the number of values of all the points in each polygon. For string fields, this totals the number of strings for all the points in each polygon.
  • Sum—For numeric fields, this adds the total value of all the points in each polygon.
  • Mean—For numeric fields, this calculates the average of all the points in each polygon.
  • Max—For numeric fields, this calculates the largest value of all the points in each polygon.
  • Range—For numeric fields, this finds the difference between the Min and Max values.
  • Stddev—For numeric fields, this finds the standard deviation of all the points in each polygon.
  • Var—For numeric fields, this finds the variance of all the points in each polygon.
  • Any—For numeric fields, this returns a sample string of a point in each polygon.

REST examples

//REST web example
[{"statisticType": "Mean", "onStatisticField": "Annual_Sales"},{"statisticType": "Sum", "onStatisticField": "Annual_Sales"}]

//REST scripting example
"summaryFields": ["statisticType": "Mean", "onStatisticField": "Annual_Sales"},{"statisticType": "Sum", "onStatisticField": "Annual_Sales"}]

//Only return Count
"summaryFields": []
outputName

(Required)

The task will create a feature service of the results. You define the name of the service.

REST examples

//REST web example
myOutput

//REST scripting example
"outputName": "myOutput"
context

(Optional)

The context parameter contains additional settings that affect task execution. For this task, there are two possible settings:

  • Extent (extent)—A bounding box that defines the analysis area. Only those features that intersect the bounding box will be analyzed.
  • Data store (dataStore)—Results will be saved to the specified data store. The default is the spatiotemporal big data store.

{
  "extent" : {extent},
  "dataStore": {data store}
}
f

The response format. The default response format is html.

Values: html | json

Example usage

The following is a sample request URL for SummarizeAttributes:

https://webadaptor.domain.com/server/rest/services/System/GeoAnalyticsTools/GPServer/SummarizeAttributes/submitJob?inputLayer={"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0", "filter":"Month = 'September'"}&fields=county&outputName=myOutput&f=json

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 jobId to periodically check the status of the job and messages as described in Check job status. Once the job has successfully completed, use jobId to retrieve the results. To track the status, you can make a request of the following form:

https://<analysis url>/SummarizeAttributes/jobs/<jobId>

Access results

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

https://<analysis-url>/SummarizeAttributes/jobs/<jobId>/results/output?token=<your token>&f=json

ResponseDescription
output

The output will always contain a table.

{"url": "https://<analysis-url>/SummarizeAttributes/jobs/<jobId>/results/output"}

The result has properties for parameter name, data type, and value. The contents of value depend on the outputName parameter provided in the initial request. The value contains the URL of the feature service layer.

{
"paramName":"output", 
"dataType":"GPRecordSet",
"value":{"url":"<hosted featureservice layer url>"}
}

See Feature output for more information about how the result layer is accessed.