geoprocessor

AMD: require(["esri/rest/geoprocessor"], (geoprocessor) => { /* code goes here */ });
ESM: import * as geoprocessor from "@arcgis/core/rest/geoprocessor.js";
Object: esri/rest/geoprocessor
Since: ArcGIS Maps SDK for JavaScript 4.19

Represents a GP resource exposed by the ArcGIS REST API. A GP 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:

  • execute - for when the execution type is synchronous.
  • submitJob - for when the execution type is asynchronous.

If processExtent is not set then execute and submitJob will format web requests compatible with ArcGIS version prior to 10.6.1.

Method Overview

Name Return Type Summary Object
Promise<Object>

Sends a request to the server to execute a synchronous GP task.

geoprocessor
Promise<JobInfo>

Submits a job to the server for asynchronous processing by the GP task.

geoprocessor

Method Details

execute

Method
execute(url, params, options, requestOptions){Promise<Object>}

Sends a request to the server to execute a synchronous GP task.

The results can be retrieved using the fetchResultData(), fetchResultImage(), or fetchResultMapImageLayer() methods.

Parameters
url String

URL to the ArcGIS Server REST resource that represents a Geoprocessing service.

params Object
optional

Specifies 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>
}

options GPOptions
optional

specifies the input options for the geoprocessing service return values. The options argument could be an Object of the form:

{
  returnZ: true
}

requestOptions Object
optional

Additional options to be used for the data request.

Returns
Type Description
Promise<Object> When resolved, returns an object with the following properties:
{
  messages: <GPMessage[]>,
  results: <ParameterValue[]>
}
See the GPMessage and ParameterValue classes for more information about the information in this object.

submitJob

Method
submitJob(url, params, options, requestOptions){Promise<JobInfo>}

Submits a job to the server for asynchronous processing by the GP task. The method will resolve immediately after the job has been submitted to the server. Use waitForJobCompletion() to be notified when the job has completed and optionally periodic job status.

The results can be retrieved using the fetchResultData(), fetchResultImage(), or fetchResultMapImageLayer() methods.

Parameters
url String

URL to the ArcGIS Server REST resource that represents a Geoprocessing service.

params Object
optional

specifies 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>
}

options GPOptions
optional

specifies the input options for the geoprocessing service return values. The options argument could be an Object of the form:

{
  returnZ: true
}

requestOptions Object
optional

Additional options to be used for the data request.

Returns
Type Description
Promise<JobInfo> When resolved, returns a JobInfo.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.