Task parameter properties (REST)

Each geoprocessing task has at least one parameter. Each parameter of a task has a set of descriptive properties that help you understand the parameter and provide appropriate value for the successful execution of the task. The screen capture below shows an example task parameter Distance, as seen in geoprocessing task page in the services directory. The significance of each property is described below.

Task parameter properties

Data type

The data type of the parameter specifies the type of value that the client must provide for the parameter. The value of a parameter can be as simple as a string, long, double, Boolean or date. Or it can be a featureset (a collection of features with attributes similar to featureclass), table, or a raster. For example, if the data type is a long you must provide a numeric value between −2,147,483,648 to 2,147,483,647. Any other decimal or string values will result in unexpected behavior of the tool. Similarly, if it is a raster data type, you must provide an appropriate raster data to successfully run the tool. The list below shows the data types of a task parameter and its expected values.

Data type Value Example JSON representation

GPLong

An integer value between −2,147,483,648 to 2,147,483,647

345

GPDouble

Decimal values

1.414

GPString

String

TestString

GPBoolean

true or false

true

GPLinearUnit

A value that has a distance value and its unit of measurement such as miles, kilometers, feet, and so on.

{ "distance" : 345.678, "units" : "esriMiles" }

GPDate

Number that represents the number of milliseconds since epoch (January 1, 1970) in UTC.

1199145600000

GPDataFile

Any file type such as .txt, .pdf, .csv, and so on.

{ "url" : "http://myserver/myfile" }

GPRasterDataLayer

Raster data that consists of a matrix of cells (or pixels) organized into rows and columns (grid) where each cell contains a value representing information.

{ "url" : "http://myserver/lake.tif", "format" : "tif" }

GPRecordSet

Tables that are represented in rows and columns.

{
"fields":[{"name":"Id","type":"esriFieldTypeString","alias":"Id"},
{"name":"State_Name","type":"esriFieldTypeString","alias":"State
Name"},
{"name":"State_Abbr","type":"esriFieldTypeString","alias":"State
Abbr"}],
"features" : [
 { "attributes" : {"Id" : 43, "State_Name" :
"California","State_Abbr":"CA"},
{ "attributes" : {"Id" : 67, "State_Name" :
"Colorado","State_Abbr":"CO"}]}
TypeString","alias":"Id"},

GPFeatureRecordSetLayer

Features that have a geometry, spatial reference, field definitions, and features.

GPFeatureRecordSetLayer JSON

{ 
"geometryType" : "esriGeometryPoint",
"fields":[
  {"name":"Id","type":"esriFieldTypeOID","alias":"Id"},
  {"name":"Name","type":"esriFieldTypeString","alias":"Name"}],
"spatialReference" : {"wkid" : 4326},
"features" : [
    { "geometry" : {"x" : -104.44, "y" : 34.83,
           "spatialReference" : {"wkid" : 4326}}, 
      "attributes" : 
           {"Id" : 43,"Name" : "Feature 1"}},
    { "geometry" : {"x" : -100.65, "y" : 33.69,
            "spatialReference" : {"wkid" : 4326}},
      "attributes" : 
           {"Id" : 42,"Name" : "Feature 2"}}
    ]
}

GPMultiValue

An array of GP parameter values of the same data type.

For example, GPMultiValue:GPString, GPMultiValue:GPLinearUnit

["Parcels", "Street Lights"]

[ { "distance" : 345.67, "units" : "esriMiles" }, { "distance" : 36, "units" : "esriMiles" } ]

NoteNote:
  • For GPRecordSet and GPFeatureRecordSetLayer parameters, if you have a large number of records and features, you can store the JSON structure in a file and provide the URL as an input. For example, { "url" : "http://myserver/myfeatures/afile.txt"}. The text file must have featureset or recordset in JSON format.
  • In the case of GPMultiValue:GPFeatureRecordSetLayer data type, the featuresets must have field definitions for successful execution.

Display name

The display name is a meaningful name for the parameter.

Direction

The direction helps you identify whether the parameter is an input or output parameter.

When executing a task, the client needs to provide the values for the input parameters only. When the task has been run successfully, the output parameters will be created by the server, and the client can access the values of these output parameters.

Default value

When publishing a geoprocessing service, the geoprocessing tasks are created from successful geoprocessing tool results. The Default Value shows the values of the parameters in the result from which the task was created. The default value of an input parameter is an example of the parameter value that should be passed for successful execution of the task, and the default value of an output parameter is an example of expected output from the task.

Parameter type

There are three Parameter Types:

  1. esriParameterTypeRequired: Parameter is required for successful execution. The client must provide a value for the parameter when executing an operation on the task resource.
  2. esriParameterTypeOptional: Parameter is optional for successful execution.
  3. esriParameterTypeDerived: The parameter value is an output parameter derived from other input parameters and hence the client doesn't have to provide a value.

Category

When there are many input and output parameters, they are usually grouped into specific categories for better understanding by the tool author. The screen capture below shows an example of categories as seen in the ArcGIS for Desktop tool dialog box.

Category property

The category specifies whether the parameter belongs to any specific category as designed by the tool author. The category value can be used when designing widgets for geoprocessing tasks.

Choice list

Some GPString parameters will have an additional Choice List property. A choice list is a predefined set of values determined by the publisher for the successful execution of the tool. The client must choose one of the values from the choice list for successful execution. The task will fail if the client provided any value other than the choice list values. The screen capture below shows choice list values Street network, Bike network, or Walk network for the GPString parameter Transportation_mode_network. When such choice-list values are provided the client must choose one of the values for successful execution.

Choice List property

Learn more about creating choice-list values for parameters when publishing a task

Related Topics

12/18/2014