Summarize Attributes

Summarize Attributes

Summarize Attributes takes an input layer and summarizes and calculate statistics on like values. The most basic statistic is the count of the number of features with a specified value, but you can get other statistics as well.

For example, suppose 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 field DISTRICT_MANAGER_NAME 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 would be calculated as well as for any other manager listed in the DISTRICT_MANAGER_NAME field.

Request URL

http://<analysis url>/SummarizeAttributes/submitJob

Request parameters

Parameter

Description

inputLayer

(Required)

The features that will be summarized.

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 URL to a big data catalog service layer with an optional filter to select specific features
  • A feature collection

Examples:

  • {"url": <feature service layer url>, "filter": <where clause>}
  • {"layerDefinition": {}, "featureSet": {}, "filter": <where clause>}

fields

(Required)

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

Examples:

  • "fields" : "property type"
  • "fields" : "property type, county"

summaryFields

A list of field names and statistical summary types you want to calculate for features that are summarized together. Note that the count of features with the same fields values is always returned. By default, all statistics are returned.

Syntax: [{"statisticType" : "<statistic type>", "onStatisticField" : "<field name>" }, ...]

fieldName is the name of the fields found in the input point layer.

statisticType is one of the following for numeric fields:

  • Count—Totals the number of values of all the points in each polygon.
  • 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.
  • Range—Finds the difference between the Min and Max values.
  • Stddev—Finds the standard deviation of all the points in each polygon.
  • Var—Finds the variance of all the points in each polygon.

statisticType is one of the following for string fields:

  • Count—Totals the number of strings for all the points in each polygon.
  • Any—Returns a sample string of a point in each polygon.

Examples:

  • "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.

Example: "outputName" : "myOutput"

context

Context contains additional settings that affect task execution. For this task, there is one setting:

  • Extent (extent)—A bounding box that defines the analysis area. Only those features that intersect the bounding box will be analyzed.

f

The response format. The default response format is html.

Values: html | 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 Checking job status. Once the job has successfully completed, use the jobId to retrieve the results. To track the status, you can make a request of the following form:

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

Accessing 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:

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

Parameter

Description

output

The output will always contain a table.

Request:
{"url": 
"http://<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.

10/6/2017