Geoprocessing provides tools and a framework to perform analysis and manage geographic data. The modeling and analysis capabilities geoprocessing provides make ArcGIS a complete geographic information system.
Geoprocessing provides a large suite of tools for performing GIS tasks that range from basic buffer and polygon overlays to complex regression analysis and image classification. The kinds of tasks to automate can be mundane, such as maneuvering a large amount of data from one format to another, or the tasks can be quite creative, using a sequence of operations to model and analyze complex spatial relationships. Examples of this include:
- Calculating optimum paths through a transportation network
- Predicting the path of wildfire
- Analyzing and finding patterns in crime locations
- Predicting which areas are prone to landslides
- Predicting flooding effects of a storm
Geoprocessing is based on a framework of data transformation. A typical geoprocessing tool performs an operation on an ArcGIS dataset (such as a feature class, raster, or table) and produces a new dataset as the result of the tool. Each geoprocessing tool performs a small, yet essential operation on geographic data.
Geoprocessing allows you to combine a sequence of tools in what is called a model. In a model, the output of one tool is fed into another, which allows you to automate your workflows. Geoprocessing tools and models can be shared with others by packaging them into an easily shared geoprocessing package, or by creating web services.
You can add to the suite of system tools installed with ArcGIS Desktop by creating tools using ModelBuilder or Python. Tools you create are called custom tools and become an integral part of geoprocessing, just like system tools. You can open and run your tools from the Search, Catalog, or ArcToolbox window, use them in ModelBuilder and the Python window, call them from another script, add them as toolbar buttons, and share them as web services or as a geoprocessing package.
You can take a quick tour of geoprocessing and explore all geoprocessing topics in more detail in the ArcGIS Desktop Help system.
Use geoprocessing in ArcGIS Runtime
There are two ways an ArcGIS Runtime application can use a geoprocessing tool:
- Consume a local geoprocessing package (.gpk) with the ArcGIS Runtime local server. The geoprocessing tool, script, or model and any data that it uses is packaged and shared from ArcMap, and may have been emailed or uploaded to arcgis.com for your use. This geoprocessing package can then be passed to the local server, which starts a local geoprocessing web service. This web service's tasks can be consumed by ArcGIS Runtime applications. With ArcGIS Runtime SDK for .NET, this is only available using the Windows Desktop API. Windows Store and Windows Phone apps can only consume geoprocessing tasks published as ArcGIS services, as described below.
- Consume a remote ArcGIS Server task. A geoprocessing web service has been published from ArcMap (to ArcGIS Server or to an on-premises server). This web service and its tasks can be consumed by web-based clients such as ArcGIS for Desktop, ArcGIS Explorer, custom web applications, and ArcGIS Runtime applications.
Notice that both of the above methods result in the ArcGIS Runtime application running a geoprocessing task from a web service.
Geoprocessing tasks in ArcGIS Runtime
The ArcGIS Runtime API works with geoprocessing tools and models through geoprocessing service tasks. These tasks are hosted online, through an ArcGIS Server, or hosted locally by providing the local server with an ArcGIS Runtime enabled geoprocessing package from which it creates a local web service.
What is a geoprocessing task?
A geoprocessing task is a REST child resource of a geoprocessing service. A geoprocessing service can host one or more tasks. A task has a set of parameters that define how a client can interact with the task and what kind of input must be passed to it to execute the task. The server executes the task and returns output values to the client. Output values could include a map service to show the results. This allows for the display of complex data and raster data.
Tasks defined in HTML task pages
A developer can use HTML service and task pages to discover how to code against the task. You can access the geoprocessing service REST URL in a browser (also known as the service page in the services directory). The URL of a local geoprocessing service can also be placed in a browser to explore geoprocessing task and service parameters. A geoprocessing service lists an HTML link for each of its geoprocessing tasks.
The access URL for a geoprocessing task is formatted as http://gpservice-url/taskName and is also called the task page. Clients can access the task page in a web browser to find information on task parameters and the task operation.
What are task parameters?
Task parameters are the inputs and outputs of a geoprocessing task and vary from task to task based on its geoprocessing functionality. Each parameter has a set of properties that provide information such as name, data type, whether the parameter is required or optional, and so on. The developer must populate the required input parameters to run the task.
When the task completes, the developer can then use the results. Results can return in a variety of ways; therefore, it is important to understand the different output parameter types that can return from a geoprocessing task to handle the results properly. To learn about parameter types, see Geoprocessing task parameters.
A geoprocessing task may output a map service result. This is particularly useful if your task returns a large number of features the client application has to symbolize and draw, or if your task returns a data type that cannot be added directly to the map via the API, such as raster data. The default symbology of this map service is determined when the geoprocessing package is shared in ArcMap.
In what ways can tasks run?
Tasks from a local geoprocessing service can run with the Execute Task or the Submit Job operation. Local geoprocessing services hosted by the Runtime local server can be started to support the synchronous ExecuteAsync method or the asynchronous SubmitJobAsync method.
Both ExecuteAsync and SubmitJobAsync are asynchronous .NET methods. ExecuteAsync kicks off a GP task to run synchronously on the server.
Tasks from an ArcGIS Server geoprocessing service supports an Execute Task or Submit Job operation. If the execution mode of the task's parent service is synchronous, Execute Task is supported. If the service is asynchronous, Submit Job is supported.
Once a service is running, it is not possible to change the execution type. The asynchronous SubmitJobAsync method is recommended for long running tasks you might want to cancel or if you want access to processing messages. Although Execute Task is often described as synchronous, many APIs have provided a synchronous execute method that blocks the calling application thread and an asynchronous execute method that cannot be cancelled but will not block the calling thread.