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.
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. |
|
GPFeatureRecordSetLayer | Features that have a geometry, spatial reference, field definitions, and features. | GPFeatureRecordSetLayer JSON |
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:
- 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.
- esriGPParameterDirectionInput : Input parameter
- esriGPParameterDirectionOutput : 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.
- The default value of GPFeatureRecordSet and GPRecordSet will have additional info on schema of the featureset/recordset. The schema includes GeometryType, HasZ, HasM, Spatial Reference, Fields, and Features. The screen capture below shows an example schema of GPFeatureRecordSet data type.
The client should provide input featuresets that comply with the schema defined by the default value for successful execution of the tool. The Features property of the schema will be none in most cases. However, if the task was published with the Include Features option, the included features will be listed in the default value.
- GPDataFile, GPRasterData, and GPRasterDataLayer parameters do not have default values.
Parameter type
There are three Parameter Types:
- esriParameterTypeRequired: Parameter is required for successful execution. The client must provide a value for the parameter when executing an operation on the task resource.
- esriParameterTypeOptional: Parameter is optional for successful execution.
- 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 Desktop tool dialog box.
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.
Learn more about creating choice-list values for parameters when publishing a task