Skip To Content

Geoprocessing task parameters

In this topic

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 and 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 appropriate raster data to successfully run the tool. The list below shows the data types of a task parameter and its expected values.

Data typeValueExample 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" } ]

Note the following:

  • 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 a featureset or recordset in JSON format.
  • In the case of GPMultiValue:GPFeatureRecordSetLayer data type, the featuresets must have field definitions for successful execution.