Use web tools with an output feature service

When consuming a web tool with a regular feature output, the output is generated on the server and sent back to the client as a feature. Output feature services reside in the ArcGIS Data Store of the hosting server and allow you to serve the output feature data and nonspatial tables over the network rather than saving the result on a local drive. This also saves the overhead of transporting resulting data back to the client, improving the efficiency of a web tool if the size of the output feature result is large. It also makes your data available to various clients, such as web clients, desktop apps, and field apps.

Authoring

To use this feature, the output must be a feature class or table.

You don't need to change anything when you design the web tool, regardless of whether the output is optional or required.

Publishing

To share a web tool with an output feature service, the following software requirements must be met:

  • ArcGIS Pro 2.3 or later.
  • ArcGIS Server and Portal for ArcGIS 10.7 or later.
  • ArcGIS Server must be federated to Portal for ArcGIS.
  • Portal for ArcGIS must have a hosting server.

After you run the tool, configure the following settings in the Share As A Web Tool pane:

  • Share the web tool only with groups in your portal or ArcGIS Enterprise. Leave the Everyone option unchecked to avoid permission issues when the tool is consumed.
  • Set the Execution Mode option to Asynchronous.
  • Leave the View output in map image layer option unchecked.
  • The Maximum number of records returned by server setting has no effect on the output feature service.
  • To disable the output feature service parameter in the published output, click the Configure Tool Properties button Configure Tool Properties, and uncheck the Add optional output feature service parameter option.

When using the CreateGPSDDraft function to publish a web tool, specify the server_type argument as MY_HOSTED_SERVICES. There is no option to remove this optional Output feature service name parameter.

When using the GeoprocessingSharingDraft class, set the enableOutputFeatureService property to True or False depending on whether you want this optional Output feature service name parameter.

Consume a web tool with a new output feature service

When consuming a web tool with feature or table output, an additional optional input parameter named Output feature service name is made available at the end of the list of options. Below the option are the Overwrite an existing Output Hosted Feature Service and Create a new Output Feature Hosted Service if overwrite fails options used for overwriting an existing output feature service. This output parameter is generated during the publishing process. It cannot be removed or renamed once the web tool is published. To successfully consume a web tool with a new output feature service, provide a service name in the text box that meets the following requirements:

  • The name of the output feature service must be unique across all hosted services of your portal, because all the output feature services will reside in the Hosted folder of your portal.
  • The name can contain only alphanumeric characters or underscores and must not contain more than 120 characters.
  • The portal user must have privileges to create an output feature service. The only roles with this privilege are Publisher and Administrator. For portal users with a custom role, that role must have Members/View, Content/Publish hosted feature layers, and Content and Analysis/Standard Feature Analysis privileges.

When consuming the web tool with an output feature service, all output features are copied to the hosting server's data store, regardless of where the original result resides on the server.

Note:

When you publish a web tool to an ArcGIS Server site federated with your portal, an allowconnection command must be run on the hosting server. Otherwise, the results cannot be copied to the hosting server.

When the web tool runs, the server provides a URL to the result feature service. If you consume the web tool in ArcGIS Pro, the result is added as a layer with a service URL to the table of contents. If you consume the web tool from a REST endpoint, the result is a JSON representation of the URL.

Note:

The Output feature service name parameter is optional. If you leave the Output feature service name parameter unspecified and consume a web tool, a regular output feature or table is generated.

The original output parameter properties affect the way the feature service is rendered. The following are common scenarios:

  • Multiple outputs—When there are multiple output feature parameters, each output result is added as a layer to the output feature service, but there is only one output feature service when running a web tool. If there are different spatial references among these layers, all layers will project to the spatial reference of the first layer.
  • Empty output—If the result of an output parameter is empty when running the web tool, a layer with empty features is generated and added to the service.
  • Optional or derived output—If the output parameter type is optional or derived, it is possible that the output will not be generated when running the web tool. In this case, no layer is added to the service.
  • Output with multiple values—Running a web tool that has an output with multiple values does not support a feature output service.
  • Symbology—If symbology is defined for the tool output, the output feature service maintains that symbology. If symbology is not defined while authoring the tool, default symbology is used.

Overwrite an existing hosted feature service

You can overwrite an existing output feature service from ArcGIS Pro 3.0 and ArcGIS Enterprise 11 or later. Consider the requirements and privileges below before overwriting an output feature service.

The following requirements are related to the spatial reference and type of client:

  • If the spatial reference of current analysis output and the layer of the existing output feature service is different, you cannot overwrite the service.
  • You can only overwrite from ArcGIS Pro 3.0 and the REST endpoint. Overwriting from Python, Map Viewer Classic, and Web AppBuilder is not supported.

The privileges to overwrite an existing output feature service are related to the role of the ArcGIS Enterprise login account.

  • The role must have a privilege to create an output feature service, which is limited to Publisher and Administrator. For a custom role, you must enable Members/View; Content/Publish hosted feature layers; Content/Create, update, and delete; and Content and Analysis/Standard Feature Analysis privileges.
  • An administrator role can overwrite any hosted feature services.
  • A publisher can only overwrite the owned hosted feature services.

Do the following to overwrite from ArcGIS Pro 3.0:

  • Open the web tool task and check the Output feature service name option. Below the parameter is an unchecked Overwrite an existing Output Hosted Feature Service check box and a deactivated Create a new Output Feature Hosted Service if overwrite fails check box.
  • Use the text box to provide an existing service name or JSON expression as input, or click the Browse button to select the service to overwrite.
  • Check the Create a new Output Feature Hosted Service if overwrite fails check box, and the Create a new Output Feature Hosted Service if overwrite fails is active. Leave the activated check box unchecked or checked and click Run to overwrite.
  • For an unsuccessful overwriting with the unchecked Create a new Output Feature Hosted Service if overwrite fails check box, an error message is returned. If the check box is checked, the unsuccessful overwriting creates a new output hosted feature service with _1 as an appendix after the initial failed attempt. Further attempts will increase the appendix to _2, _3, and so on.