The Geoprocessor task
The Geoprocessor
class in the ArcGIS API for JavaScript is what coordinates the input parameters, executes the geoprocessing task, and coordinates the collection of the task results. In this way, it is very similar to the other tasks you have worked with in this book, such as the QueryTask
.
You kick off the geoprocessing operation by calling either Geoprocessor.execute()
or Geoprocessor.submitJob()
and passing in the required input parameters. We'll discuss the difference between these two methods later. After executing the geoprocessing task, the results are returned to the Geoprocessor
object where they are processed by a callback function.
To create an instance of the Geoprocessor
task, import the esri/tasks/Geoprocessor
module and supply the URL of the geoprocessing service to the class constructor:
require(["esri/tasks/Geoprocessor"], function(Geoprocessor) { var url = "<gp service url>"; var gp = new Geoprocessor(url); });