Execute GP task
- URL:http://<task-url>/execute
- Version Introduced:9.3
Description
The execute operation is performed on a GP task resource for geoprocessing services when the execution type is synchronous. The result of this operation is a GP result resource. This resource contains an array of result parameters and the geoprocessing task execution messages. Each result parameter provides information such as the parameter name, the data type, and most importantly, the value for that parameter.
The information provided by each result parameter is identical to the information provided by the result parameter resource. Based on the data type of the parameter, the values provide different types of information. Given this fact, the value has different structures based on the data type. Details about values for every data type are included with the result parameter resource.
You can provide arguments to the execute operation as query parameters. These parameters include the input parameters accepted by this service and their corresponding values. The input values for the execute operation are identical to the input values for the submit job operation. Additionally, you can specify environment parameters such as the output spatial reference and the process spatial reference.
Request parameters
Parameter |
Details |
---|---|
f |
Description: The response format. The default response format is html. Support for f=amf was added at 10.0 and removed at 10.7. Support for f=geojson was added at 10.5. Values: html | json | kmz | geojson |
<gpParameter1>, <gpParameter2>, ... | Description: The various input parameters accepted by the corresponding GP task. These parameters are listed in the parameters property of the JSON representation associated with the GP task resource. The valid values for the input parameters are dependent on the data type of the parameter. These values are discussed in more detail in Submit GP Job. |
env:outSR | This option was deprecated at 10.6.1. See the context parameter below. |
env:processSR | This option was deprecated at 10.6.1. See the context parameter below. |
context | This option was added at 10.6.1. Description: The context of the service can be specified. Currently, context supports outSR, processSR, and extent. outSR is the spatial reference of the output geometries. processSR is the spatial reference that the model will use to perform geometry operations. The spatial reference can be specified as either a well-known ID or as a spatial reference JSON object. If the outSR is not specified, the output geometries are in the spatial reference of the input geometries. If processSR is specified and outSR is not specified, the output geometries are in the spatial reference of the process spatial reference. If processSR is specified and outSR is not specified, the output geometries are in the spatial reference of the process spatial reference. extent will only process features that overlap the specified extent. The output features will have an extent that is the same or larger than extent. |
returnZ | This option was added at 10.1. Description: If true, z-values will be included in the results if the features have z-values. Otherwise, z-values are not returned. The default is false. |
returnM | This option was added at 10.1. Description: If true, m-values will be included in the results if the features have m-values. Otherwise, m-values are not returned. The default is false. |
returnTrueCurves | This option was added at 10.5. Description: If true, true curves will be returned in the results if the features have curves. The default is false. The geojson output format does not support curves. The combination of f=geojson and returnTrueCurves=true should not be used. |
returnFeatureCollection | This option was added at 10.6. Description: If true, the feature collection of the results will be returned. The default is false. This option is only available if the return data type is Feature class. |
Example usage
With this operation, the majority of the parameters that you include in your request are dependent on the input parameter types of the geoprocessing task that you are executing. The GP execute and submitJob operations share the same syntax for all input parameter types, and examples of all input parameter types are discussed in Submit GP Job.
Example 1: Execute the MessageInABottle task originating at lat-long [0, 0] for 50 days:
Example 2: Execute the task similar to Example 1, but request the output spatial reference to be Web Mercator (102113):
Example 3: Execute the Viewshed task, and define the output spatial reference as WGS84 (wkid: 4326).
JSON response syntax
{"results" : [ { "paramName" : "<paramName1>", "dataType" : "<dataType1>", "value" : <valueLiteralOrObject1> }, { "paramName" : "<paramName2>", "dataType" : "<dataType2>", "value" : <valueLiteralOrObject2> }],"messages" : [ {"type" : "<type1>", "description" : "<description1>"}, {"type" : "<type2>", "description" : "<description2>"}]}
JSON response example
{
"results" : [
{
"paramName" : "Output",
"dataType" : "GPFeatureRecordSetLayer",
"value" : {
"geometryType" : "esriGeometryPolyline",
"spatialReference" : {
"wkid" : 102113
},
"features" : [
{
"attributes" : {
"FID" : 1,
"FNODE_" : 0,
"Shape_Length" : 1978374.8698808267
},
"geometry" : {
"paths" : [
[
[
0,
0
],
[
-108217.97210000083,
26094.129900000989
],
[
-217996.3478000015,
44553.482400000095
],
[
-329200.10810000077,
49628.166999999434
],
[
-433777.05680000037,
87783.983500000089
],
[
-534112.75899999961,
136007.38540000096
],
[
-643737.89559999853,
155360.90810000151
],
[
-755033.3936999999,
153047.74670000002
],
[
-866085.40799999982,
145333.35249999911
],
[
-976217.62999999896,
129114.93939999864
],
[
-1087511.3233000003,
126718.78040000051
],
[
-1198617.1088999994,
119823.3104000017
],
[
-1305317.4675999992,
88084.511799998581
],
[
-1411935.6565000005,
56073.440000001341
],
[
-1518314.0241999999,
23275.155000001192
],
[
-1626332.2846999988,
-3633.6050999984145
],
[
-1736260.3031000011,
-21179.790600001812
],
[
-1847319.2710000016,
-13568.72899999842
],
[
-1922858.3764999993,
27404.295000001788
]
]
]
}
}
],
"exceededTransferLimit" : false
}
}
],
"messages" : [
]
}