Geoprocessing is a fundamental part of enterprise GIS operations. Geoprocessing provides GIS users with data analysis, data management, and data conversion tools.
A geoprocessing service is a collection of published tools that perform tasks necessary for manipulating and analyzing geographic information across a wide range of disciplines. Each tool performs one or more operations, such as projecting a dataset from one map projection to another, adding fields to a table, or creating buffer zones around features. A tool accepts input (such as feature sets, tables, and property values), runs operations using the input data, and generates output for presentation in a map or further processing by the client. Tools can be run synchronously (in sequence) or asynchronously. A synchronous geoprocessing service performs best when a task takes only a few seconds; an asynchronous geoprocessing service is suitable for long-running tasks.
Use a geoprocessing service to do the following:
- List available tools and their input and output properties.
- Run a task synchronously.
- Submit a job to a task asynchronously.
- Get job details, including job status.
- Display results using a map service.
- Display results using a hosted feature service.
- Retrieve results for further processing by a client.
Many GIS tasks involve the repetition of work, and this creates the need for a framework to provide automation of workflows. Geoprocessing services address this by using a model to combine a series of operations in a sequence and exposing the model as a tool.
A geoprocessing service can contain one or more tools that use input data from a client application, process it, and return output in the form of features, maps, reports, files, or services. These tools are first authored and run in ArcGIS Pro or ArcGIS Desktop, typically as a custom model or script tool, before being shared to an ArcGIS Server installation. To publish a geoprocessing service from ArcGIS Pro, see Share your geoprocessing service. To publish a web tool with a geoprocessing service from ArcGIS Pro, see Share your web tool.
Each task of a geoprocessing service includes operations that return results after a task is successfully completed. The supported operations are as follows:
- execute—Use when executionType is synchronous. A client must wait for the results.
- submitJob—Use when executionType is asynchronous. A client can do other things while waiting for the task to complete.
A geoprocessing service is a resource that can be accessed through a URL. The URL format for a geoprocessing service is https://<server name>/<instance name>/rest/services/<Service Name>/GPServer, for example, https://myServer/webadaptor/rest/services/BufferPoints/GPServer.
A geoprocessing service has properties including Service Description, Tasks, Execution Type, and Result Map Server. The geoprocessing tasks that are published in a geoprocessing service are its child resources.
A geoprocessing service does not include operations, but in an asynchronous geoprocessing service, tasks support submitJob and cancel job operations. In a synchronous geoprocessing job, tasks support the execute operation.
The tasks in a geoprocessing service inherit the Execution Type and Result Map Server properties and include additional properties such as Description and Parameters. The properties of the service and the task are determined by the publisher of the service and cannot be modified by clients. However, an administrator can edit service properties using Server Manager.
The figure below shows the hierarchy of geoprocessing REST resources:
Input and output
Most geoprocessing tasks have both inputs and outputs. There are slight differences between the handling of input and output by geoprocessing services.
For both synchronous and asynchronous geoprocessing services, the input of a task should follow the syntax based on the data type of a parameter.
For synchronous geoprocessing services, the result is given directly once the execute operation completes.
For asynchronous geoprocessing services, the result must be accessed through the GP Result resource after the submitJob operation.
While the submitJob operation is running, the status of the job can be accessed through GP Job.
For both synchronous and asynchronous services, the syntax of the result parameters will be based on their data types.
To use a secured geoprocessing service, a token must be passed with the submitJob or execute operation as an additional parameter. A sample GET request is https://domain/server/rest/services/LandUseReport/GPServer/LandUse/submitJob?Area_of_Interest=testArea&f=json&token=myToken.
When you use URLs to reference a secured map service or a feature service as an input, a token is also required, regardless of whether the geoprocessing service is secured or public. An exception is when the secured geoprocessing service is on the same server as the secured input services. The following is an example of accessing secured web layers as an input:
The following is an example of accessing secured web layers as an input:
You can also use the following syntax for a secured map service, a feature service, or an image service input. The following is an alternative example of accessing secured web layers as an input:
The following is an alternative example of accessing secured web layers as an input: