Represents a GP Task resource exposed by the ArcGIS REST API. A GP Task resource represents a single task in a GP service published using the ArcGIS Server and it supports one of the following operations dependent on how the service was set up:
Constructors
new Geoprocessor(properties)
properties Object See the properties for a list of all the properties that may be passed into the constructor. |
Property Overview
Name | Type | Summary | |
---|---|---|---|
String | The name of the class. more details | more details | |
SpatialReference | The spatial reference of the output geometries. more details | more details | |
SpatialReference | The spatial reference that the model will use to perform geometry operations. more details | more details | |
Object | The options to be used for data requests. more details | more details | |
Number | The time interval in milliseconds between each job status request sent to an asynchronous GP task. more details | more details | |
String | ArcGIS Server Rest API endpoint to the resource that receives the geoprocessing request. more details | more details |
Property Details
declaredClassStringreadonly
The name of the class. The declared class name is formatted as
esri.folder.className
.outSpatialReferenceSpatialReference
The spatial reference of the output geometries. If not specified, the output geometries will be in the spatial reference of the input geometries. If processSpatialReference is specified and
outSpatialReference
is not specified, the output geometries will be in the spatial reference of the process spatial reference.processSpatialReferenceSpatialReference
The spatial reference that the model will use to perform geometry operations. If
processSpatialReference
is specified and outputSpatialReference is not specified, the output geometries will be in the spatial reference of the process spatial reference.requestOptionsObject
The options to be used for data requests. These options can also be controlled through the
requestOptions
method parameter.updateDelayNumber
The time interval in milliseconds between each job status request sent to an asynchronous GP task.
Default Value: 1000urlString
ArcGIS Server Rest API endpoint to the resource that receives the geoprocessing request.
Method Overview
Name | Return Type | Summary | |
---|---|---|---|
Promise | Cancels an asynchronous geoprocessing job. more details | more details | |
Cancels the periodic job status updates automatically initiated when submitJob() is invoked for the job identified by | more details | ||
Promise | Sends a request to the GP Task for the current state of the job identified by | more details | |
Promise | Sends a request to the server to execute a synchronous GP task. more details | more details | |
Promise | Sends a request to the GP Task to get the task result identified by | more details | |
Promise | Sends a request to the GP Task to get the task result identified by | more details | |
MapImageLayer | Get the task result identified by | more details | |
Promise | Submits a job to the server for asynchronous processing by the GP task. more details | more details |
Method Details
cancelJob(jobId, requestOptions){Promise}
Cancels an asynchronous geoprocessing job. Requires an ArcGIS Server 10.1 service or greater.
Parameters:jobId StringA string that uniquely identifies a job on the server. It is created when a job is submitted for execution and later used to check its status and retrieve the results.
optionalrequestOptions ObjectAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise When resolved, returns an object that includes the status and job ID. cancelJobStatusUpdates(jobId)
Cancels the periodic job status updates automatically initiated when submitJob() is invoked for the job identified by
jobId
. You can still obtain the status of this job by calling the checkJobStatus() method at your own discretion.Parameter:jobId StringA string that uniquely identifies the job for which the job updates are cancelled.
checkJobStatus(jobId, requestOptions){Promise}
Sends a request to the GP Task for the current state of the job identified by
jobId
.Parameters:jobId StringThe jobId returned from JobInfo.
optionalrequestOptions ObjectAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise When resolved, returns the status of the job as a property of an Object. execute(params, requestOptions){Promise}
Sends a request to the server to execute a synchronous GP task.
Parameters:params ObjectSpecifies the input parameters accepted by the task and their corresponding values. These input parameters are listed in the parameters field of the associated GP Task resource. For example, assume that a GP Task resource has the following input parameters:
<GPFeatureRecordSetLayer>
Input_Points<GPDouble>
Distance
The
params
argument would then be an Object of the form:{ Input_Points: <FeatureSet>, Distance: <Number> }
optionalrequestOptions ObjectAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise When resolved, returns an object with the following properties:
See the GPMessage and ParameterValue classes for more information about the information in this object.{ messages: <GPMessage[]>, results: <ParameterValue[]> }
getResultData(jobId, resultName, requestOptions){Promise}
Sends a request to the GP Task to get the task result identified by
jobId
andresultName
.Parameters:jobId StringThe jobId returned from JobInfo.
resultName StringThe name of the result parameter as defined in Services Directory.
optionalrequestOptions ObjectAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise When resolved, returns an object with a property named result
of type ParameterValue, which contains the result parameters and the task execution messages.getResultImage(jobId, resultName, imageParams, requestOptions){Promise}
Sends a request to the GP Task to get the task result identified by
jobId
andresultName
as an image.Parameters:jobId StringThe jobId returned from JobInfo.
resultName StringThe name of the result parameter as defined in the Services Directory.
imageParams ImageParametersSpecifies the properties of the result image.
optionalrequestOptions ObjectAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise When resolved, returns an Object with a mapImage
property of type MapImagegetResultMapImageLayer(jobId){MapImageLayer}
Since: ArcGIS API for JavaScript 4.1Get the task result identified by
jobId
as an MapImageLayer. This method supports MapImageLayer 10.1 or greater.Parameter:jobId StringThe jobId returned from JobInfo.
Returns:Type Description MapImageLayer Returns an instance of MapImageLayer. submitJob(params, requestOptions){Promise}
Submits a job to the server for asynchronous processing by the GP task.
The task execution results can be retrieved using the getResultData(), getResultImage(), or getResultMapImageLayer() methods.
Parameters:params Objectspecifies the input parameters accepted by the task and their corresponding values. These input parameters are listed in the parameters field of the associated GP Task resource. For example, assume that a GP Task resource has the following input parameters:
<GPFeatureRecordSetLayer>
Input_Points<GPDouble>
Distance
The
params
argument would then be an Object of the form:{ Input_Points: <FeatureSet>, Distance: <Number> }
optionalrequestOptions ObjectAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise When resolved, returns an object with the following properties:
See the GPMessage and ParameterValue classes for more information about the information in this object.{ messages: <GPMessage[]>, results: <ParameterValue[]> }