Calculate Composite Index

URL:
https://<spatial-analysis-url>/CalculateCompositeIndex
Methods:
GET
Version Introduced:
11.3

The Calculate Composite Index task combines multiple numeric variables to create a single index.

Learn more about how Calculate Composite Index works

Request URL

Use dark colors for code blocksCopy
1
https://<analysis url>/CalculateCompositeIndex/submitJob

Request Parameters

ParameterDescription

inputLayer

(Required)

The input table or features containing the variables that will be combined into the index.

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": {}, "featureSet": {}, "filter": <where clause>}

inputVariables

(Required)

The variables that will be combined to create the index. Provide at least two variables. For each variable, specify the following:

  • field—The numeric field from the inputLayer parameter containing the variable. Any records in the field with missing values will not be included in the analysis.
  • reverseVariable—Specifies whether the values of the variable will be reversed. If no value is specified, the value will be set to false. When true, the feature or record that originally had the highest value will have the lowest value, and vice versa. Values will be reversed after scaling. To create an index, variables must be on a compatible scale; reversing some variables may be required to ensure that the meaning of low and high values in each variable is consistent.
  • weight—The relative influence of the variable on the index. If each variable should have equal contribution, set the value to 1. Increase or decrease the weight to reflect the relative importance of the variable. For example, if a variable is twice as important as the others, use a weight of 2.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
"inputVariables":
[
  {"field":"median_income", "reverseVariable": true, "weight": 2},
  {"field": "pct_uninsured", "reverseVariable": false, "weight": 1},
  {"field": "pct_unemployed", "reverseVariable": false, "weight": 1}
]

indexMethod

(Optional)

The methods that will be used to scale the inputVariables parameter and combine the scaled variables to create the index.

Scaling is a type of preprocessing that ensures that the variables are on a compatible scale before they are combined. The scaled variables are then combined to create a single index value. The following options are available:

  • meanScaled—Creates the index by scaling the input variables between 0 and 1 (minimum-maximum scaling) and calculating the mean of the scaled values. This method is useful for creating an index that is easy to interpret. The shape of the distribution and outliers in the input variables will impact the index.
  • meanPercentile—Creates the index by scaling the ranks of the input variables between 0 and 1 (scaling by percentile) and calculating the mean of the scaled ranks. This option is useful when the rankings of the variable values are more important than the differences between values. The shape of the distribution and outliers in the input variables will not impact the index.
  • meanRaw—Creates the index by calculating the mean of the raw input variables. This option is useful when variables are already on a compatible scale.
  • geomeanScaled—Creates the index by scaling the input variables between 0 and 1 (minimum-maximum scaling) and calculating the geometric mean of the scaled values. High values will not cancel low values, so this option is useful for creating an index in which higher index values will occur only when there are high values in multiple variables.
  • geomeanPercentile—Creates the index by scaling the ranks of the input variables between 0 and 1 (scaling by percentile) and calculating the geometric mean of the scaled ranks. This option is useful when the rankings of the variable values are more important than the differences between values and when high variable values should not cancel out low variable values.
  • geomeanRaw—Creates the index by calculating the geometric mean of the raw input variables. This option is useful when variables are already on a compatible scale and when high variable values should not cancel out low variable values.
  • sumFlagsPercentile—Creates the index by counting the number of input variables with values greater than or equal to the 90th percentile. This method is useful for identifying locations that may be considered the most extreme or the most in need.

Values: meanScaled | meanPercentile | meanRaw | geomeanScaled | geomeanPercentile | geomeanRaw | sumFlagsPercentile

Default: meanScaled

Example: "indexMethod": "meanPercentile"

outputIndexReverse

(Optional)

Specifies whether the output index values will be reversed in direction. When true, high index values will be treated as low index values and vice versa. Reversing is applied after combining the scaled variables.

Values: true | false

Default: false

Example:"outputIndexReverse": true

outputIndexMinMax (Optional)

The minimum and maximum of the output index values. Specifying a minimum and maximum value will apply minimum-maximum scaling to the combined variables.

Example: "outputIndexMinMax": "[{'min': 0, 'max': 100}]"

outputName

(Optional)

If provided, the task will create a feature service of the results. You define the name of the service. If an outputName value is not provided, the task will return a feature collection.

Syntax:

Use dark colors for code blocksCopy
1
2
3
4
5
 {
    "serviceProperties": {
      "name": "<service name>"
    }
  }

You can overwrite an existing feature service by providing the itemId value of the existing feature service and setting the overwrite property to true. Including the serviceProperties 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.

Syntax:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
{

  "itemProperties": {
            "itemId": "<itemID of the existing feature service>",
            "overwrite": true
    }
}

or

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
"serviceProperties": {
    "name": "<existing service name>"
  },
"itemProperties": {
                "itemId": "<itemID of the existing feature service>",
                "overwrite": true
    }
}

context

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 (outSR)—The output features will be projected into the output spatial reference.

Syntax:

Use dark colors for code blocksCopy
1
2
3
4
{
  "extent" : {extent},
  "outSR" : {spatial reference}
}

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:

Use dark colors for code blocksCopy
1
2
3
4
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}

After the initial request is submitted, you can use the jobId to periodically check the status of the job and messages as described in the topic Check 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:

Use dark colors for code blocksCopy
1
https://<analysis url>/CalculateCompositeIndex/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.

Use dark colors for code blocksCopy
1
https://<analysis url>/CalculateCompositeIndex/jobs/<jobId>/results/indexResultLayer?token=<your token>&f=json
ParameterDescription

indexResultLayer

The result of Calculate Composite Index is a layer containing the index results. The layer includes the fields containing the input variables after preprocessing (reversing and scaling), the raw index prior to reversing and minimum-maximum scaling, the index value, the index rank, and the index percentile. It also includes fields with the index value reclassified into quantile classes, equal interval classes, and standard deviation classes.

Example:

Use dark colors for code blocksCopy
1
{"url": "https://analysis.arcgis.com/arcgis/rest/services/tasks/gpserver/CalculateCompositeIndex/jobs/<jobId>/results/indexResultLayer"}

The result has properties for parameter name, data type, and value. The contents of value depends on the outputName value provided in the initial request.

  • If the outputName parameter was provided, the value parameter contains the URL to the feature service layer.
Use dark colors for code blocksCopy
1
2
3
4
5
{
"paramName":"indexResultLayer",
"dataType":"GPRecordSet",
"value":{"url":"<arcgis featureservice layer url>"}
}
  • If no outputName was provided, value contains a feature collection.
Use dark colors for code blocksCopy
1
2
3
4
5
{
"paramName":"indexResultLayer",
"dataType":"GPRecordSet",
"value":{"featureCollection": ... }
}

See Feature Output for more information about how the result layer or collection is accessed.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.