Authoring a web tool 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 Enterprise portal as a web tool. 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:
- Build a script or model using tools from the toolbox to construct your workflow.
- Gather the datasets your tool requires and make them available in a geodatabase or add them to the map in your project.
- Run the tool to create a successful entry in the geoprocessing history.
- Set the symbology of output datasets in your map if necessary.
- Share the history item as a web tool. When sharing your web tool, you'll can set tool properties for the tool and 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 web tool where an analyst or the general public could change the proposed pipeline route to see how a leak could impact the population downstream. The web tool results show the point where the pipeline crosses the river and the summary of the impacted population.
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 that the person running the tool generally has no control over. 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 changes 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 web tool handles where to write the intermediate data and ultimately cleans it up when it is no longer needed.
In the same way that input parameters are important to all successful tools, output parameters are equally as 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. Web tools 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.
Tip:
The same principles of tool input and output parameters, project data, and intermediate data apply to creating script tools .
Document the tool
Providing good documentation for your web tool 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.
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 web tool
The web tool can be shared by choosing Analysis > History to open the History pane. To share, right-click an item to share, and select Share As. To share as a new web tool, select Share Web Tool to open the Share As Web Tool pane. To overwrite an existing tool, select Overwrite Web Tool to open a pane with all the existing web tools published in My Content.
Make sure to select the correct tool to overwrite and click OK to open the Overwrite Web Tool pane. The processes of prepublished web tool configurations are the same for both Share Web Tool and Overwrite Web Tool, as shown below.
Alternatively, go to Share > Web Tool to choose either Share Web Tool or Overwrite Web Tool. If you choose the Share Web Tool option, select an item from a tool sharing pane with all the successful running items.
If you choose the Overwrite Web Tool option, select an item to overwrite from the pane with all the existing web tools you published in My Content. Then select an item from the pane with all the successful running items to overwrite with. The overwrite steps in this workflow are reversed when choosing from Analysis > History.
Set the web tool 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 web tool will be set up as an asynchronous service without a result map service. A default setting of 1000 max 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 web tool execution, normal processing messages will not be returned to the end user.
A web tool is always available in your My Content. You can share your tool with your organization, everyone, or select groups. The spill assessment tool is a good tool to share to specific stake holders in the organization who need to perform pipeline analysis. Selecting the appropriate groups will allow those users to quickly find and use the tool.
Copy, reference, or use URL data
Most web tools will have input or project data. When sharing the spill assessment model as a web tool, you must examine if any of the input or project data is None-URL Data or URL Data. You can copy None-URL data to the server and making a static copy of the data the service will use, or skip copying the data but create a reference that the service can access. URL data is to provide the input from a service URL.
When sharing the spill assessment model as a web tool, the project data includes river and population datasets that are static, which are infrequently updated. Copying these project data to the server is a solution. The publishing 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. In this case, check the Copy all data check box under the None-URL Data heading.
Consider if the analysis method was modified slightly and 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 include this dataset in an enterprise geodatabase or folder with a Universal Naming Convention (UNC) path that the server can access and have the tool reference the dataset. When publishing, check the Reference registered data check box under the None-URL Data heading and set a reference to the data using the ArcGIS Server data store. The publishing process maintains a reference to the database or folder instead of making a static copy. At a later time a project analyst could update the data in the enterprise geodatabase or folder, and the web tool would perform analysis against the newest pipeline proposal.
Another option is to provide a feature dataset that is neither from the user's pipeline or is frequently updated to provide the input from a web feature layer (feature service) or map image layer (map service) with a feature sublayer. When publishing, uncheck the Convert feature layer check box to preserve the URL data during the process. If this check box is checked, the data will be copied to the server during publishing and the referenced data used in the tool is static on the server. If your input is from a raster dataset, provide the URL data with web imagery layer (image service). In this case, you do not need to check the Convert feature layer check box since the URL is always maintained during publishing.
Input mode
When sharing as a web tool, it is important to decide how the client will provide the input to your web tool task, which is referred to as the input mode of a parameter. To configure the tool properties, on the Content tab, click the Configure Tool Properties button next to the tool name.
In the properties pane, expand each parameter and configure the input mode for each. If selecting the Input Mode option of User defined value, there are no data considerations since the data will be provided from the client side when running the web tool. If selecting the Choice list or Constant option, the data will be provided from the copied or referenced data on the server or the data from a service URL.
When publishing the web tool, the default value of each input and output parameter will be shown on the server REST end point. If you do not want the default value for a parameter to be shown, check the Remove default value check box for each parameter. To remove the default value for all the parameters, check the Remove all default values check box under the Parameter configuration heading.
Analyze
Analyzing a potential web tool 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, tool documented and uses supported tools that work in a web tool, so no such warning or messages will appear.
Publish
After the web tool properties have been set and you've resolved any analyzer errors, publish the web tool 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 web tool
Web tools can be found and opened from the Portal section of the Catalog pane. In addition to running the tool in ArcGIS Pro, the geoprocessing service that powers it can be used in a Python script or web application.