Quick tour of authoring and sharing geoprocessing services

Authoring a geoprocessing service involves both an authoring and sharing process. The authoring process starts with the creation of a model or Python script tool in ArcGIS Pro. Once you've authored and successfully run your tool, you can share it to ArcGIS Server as a geoprocessing service. Certain data, tool parameters, and sharing permissions must be considered when authoring and sharing. Some of these considerations are outlined in the following example and relevant sections in this topic. The following workflow describes the overall process:

  1. Build a script or model using tools from the toolbox to construct your workflow.
  2. Gather the datasets your tool requires and make them available in a geodatabase or add them to the map in your project.
  3. Execute the tool to create a successful entry in the geoprocessing history.
  4. Set the symbology of output datasets in your map, if necessary.
  5. Share the history item as a geoprocessing service. When sharing your geoprocessing service, you can set tool properties for the tool and the service.

Example: Examine the population impact of a proposed pipeline

The following model tool is a collection of tools that examine how many people might be impacted by a pipeline leak. The workflow finds intersection points between the pipeline and river and performs a downstream trace to identify how many people could be impacted. This model is set up with project data and parameters and is published as a geoprocessing service in which an analyst or the general public could change the proposed pipeline route to see how a leak could impact the population downstream. The geoprocessing service results show the point where the pipeline crosses the river and the summary of the impacted population.

Model to perform impacted population analysis for a pipeline

Tool design

All useful tools have input and output parameters. These parameters allow someone to supply different values each time the tool is run, and in turn, the tool will produce different analysis. In addition to input and output parameters, tools generally have project data and intermediate data. These are datasets over which the person running the tool generally has no control. In a model, the input parameters are marked with a P. When the model is run as a tool, any input with a P is available on the tool dialog box to set a value to be used when running the tool. From the pipeline model, the user can specify the pipeline path and a distance to buffer when performing the downstream trace. When someone uses this tool, the pipeline location and buffer size change to show the number of people ultimately impacted by the pipeline. The pipeline intersections and trace line in this example are intermediate datasets that the model tool produces during execution. These intermediate datasets are not required by the person running the tool, and they're not returned as a result. When this model is shared, the underlying geoprocessing service that powers the geoprocessing service handles where to write the intermediate data and ultimately cleans it up when it is no longer needed.

Model tool input parameters

In the same way that input parameters are important to all successful tools, output parameters are equally important. The output parameter allows the tool to return a result to the individual running the tool. In ArcGIS Pro, output parameters are important because these datasets are automatically added to the map. A tool without an output parameter would generate output but would not automatically display this information. Geoprocessing services work in much the same way; one or more output parameters are required to return the result to the end user. In the pipeline model, two output parameters exist: impact areas population showing the downstream buffer locations and the population summary table with the summary of the entire impacted population. Note that the impact areas population is both intermediate and output data. This parameter is intermediate because it is required by the Summary Statistics tool, but it has been defined as a model parameter (P) and will have this result returned to the client when the tool successfully finishes.

Model tool output parameters
Tip:

The same principles of tool input and output parameters, project data, and intermediate data apply to creating script tools Script.

Document the tool

Providing good documentation for your geoprocessing service is essential if you want your tool to be discovered, understood, and used by a wide audience. Good documentation starts with the original tool. You can supply the same type of metadata to your model or script tool as a system tool.

Learn more about documenting tools

Run the tool

After the tool has been authored, it needs to be successfully run. Running the tool creates an entry in the geoprocessing history. A tool execution that has failed cannot be shared.

Note:

Running a model in ModelBuilder does not produce an entry in the Geoprocessing History. Model tools must be run as a tool in the Geoprocessing pane.

Share your geoprocessing service

A geoprocessing service can only be shared to a stand-alone server via ArcGIS Server Connection with an administrator connection type. To add the server connection with the right type, follow the steps below.

Add new ArcGIS server connection

There are two ways to add New ArcGIS Server Connection.

  1. From ArcGIS Pro, on the Catalog tab under the Project pane, right-click anywhere in the pane and select New ArcGIS Server Connection to launch the connection window as shown below.
  2. From the Insert ribbon tab on top of ArcGIS Pro, choose the connection ribbon and choose New ArcGIS Server to launch the connection window as shown below.
Add a server connection.

Provide the Server URL and administrator login credentials. When it has completed, there will be a new server connection item with the .ags extension added under Servers in the Project pane.

Configure ArcGIS server connection type

The initial connection created in the previous step uses Publisher as the connection type. To share a geoprocessing service, an administrator connection is required. To modify the connection type, right-click the server connection item and select Properties to launch the ArcGIS Server Connection Properties window. Change the type from Publisher Connection to Administrator Connection.

Change server connection type

Publish a geoprocessing service

If the connection type of the server connection is administrator, right-click the server connection and choose Publish. Use the Geoprocessing Service option to launch the Selected History Item(s) window. Select the item from the list to launch the Publish Geoprocessing Service window. It is a good idea to examine the properties of the General, Configuration, and Content panes before publishing the service.

Publish geoprocessing service drop-down menu

Set the geoprocessing service properties

The spill assessment tool outputs features and a table. The amount of data that this tool generates and returns is limited in size, so the geoprocessing service will be set up as an asynchronous service without a result map service. A default setting of 1000 maximum records will be sufficient. A message level of Error will ensure that only messages relating to a possible tool failure are returned. In the case of successful geoprocessing service execution, normal processing messages will not be returned to the end user.

Set geoprocessing service properties

Overwrite a geoprocessing service

If the connection type of the server connection is administrator, you can overwrite a published geoprocessing service by right-clicking an existing service from ArcGIS Server Connection and select Overwrite to open the Select Tool to Publish pane. The pane lists all the analysis result items you have run in ArcGIS Pro. Select the item you want to overwrite with and click OK to open Overwrite Geoprocessing Service pane. Configure the service properties you want to update in the pane, and click Publish to overwrite.

Overwrite a geoprocessing service

Copy or reference data

All geoprocessing services either take data as input or use project data. When sharing the spill assessment model as a geoprocessing service, it will accept data from a user and process that against project data referenced in the model. At this point in sharing the tool, you must decide whether to copy the data to the server, making a static copy of the data the service will use, or create a reference that the service can access. In this particular workflow, the project data includes river and population datasets that are static; that is, these datasets are infrequently updated. In this case, it makes sense to copy the data to the server. This process collects and converts the data (if needed) into file geodatabase feature classes where they will be extracted on the server and used by the service.

Consider if the analysis method was modified slightly where the user did not propose their own pipeline. The alternative pipeline proposals came through another process, and the user provided different inputs to the tool. In this case, the proposed pipeline becomes project data. Consequently, it would be advisable to put this dataset into an enterprise geodatabase and have the tool reference it. When publishing, you would set a reference to the data using the ArcGIS Server data store. The publishing process would maintain a reference to the database instead of making a static copy. At a later time, a project analyst could update the data in the enterprise geodatabase, and the geoprocessing service would perform analysis against the newest pipeline proposal.

Publishing a geoprocessing service

Analyze

The Analyze Analyze process of sharing a geoprocessing service ensures that you can successfully publish the tool to your portal. Additionally, warning messages about data may appear, and you can take action if you deem necessary. The spill assessment tool already has the data store setup and tool documentation, and uses supported tools that work in a geoprocessing service, so no such warning or messages will appear.

Publish

After the geoprocessing service properties have been set and you've resolved any analyzer errors, publish the geoprocessing service to your portal. Depending on how much data needs to be consolidated and sent to the server, this process could take a few minutes.

Use the geoprocessing service

Geoprocessing services can be found and opened from the ArcGIS Server Connection in the Catalog pane. Available geoprocessing services

In addition to running the tool in ArcGIS Pro, the geoprocessing service Geoprocessing Service can be used in a Python script or web application.

Learn more about finding and using geoprocessing services in ArcGIS Pro