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.
- Execute 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.
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.
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.
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 or reference data
All web tools either take data as input or use project data. When sharing the spill assessment model as a web tool, 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 need to 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 particular 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 web tool would perform analysis against the newest pipeline proposal.
The Analyze process of sharing a 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.
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.