Authoring web tools with ModelBuilder

Authoring and sharing a web tool means creating a tool or workflow and defining the input and output parameters and the location of any data used.

ModelBuilder is used to create, edit, and manage geoprocessing models. Models are workflows that string together sequences of geoprocessing tools, passing the output of one tool into another tool as input. ModelBuilder can be thought of as a visual programming language for building workflows and authoring geoprocessing tools.

If you are unfamiliar with models and ModelBuilder, skip to the Get started with ModelBuilder section below for a list of useful topics.

If you have an existing model with parameters that you can run successfully in ArcGIS Pro, you can share it as a web tool without modification. The remainder of this topic addresses the finer points of authoring tools in ModelBuilder.

Create history items from models

A tool must first be run successfully before it can be shared as a web tool. To create a history item, a model must be run as a tool. A history item is not created when you run a model in ModelBuilder.

Note:

In most cases, your model needs to have parameters. You can see an example of a model tool with parameters in A quick tour of authoring and sharing web tools. You can learn more about creating model tools in Create a model tool.

Output data

You can write output paths to almost any location when creating models. When the model tool is shared as a web tool, these output paths are updated so it can run on the server. The following information outlines some best practices for creating good model tools to be shared as web tools.

A technique you can use to increase performance is to write both intermediate and output data to the in_memory workspace. When writing data in_memory, the tool does not write the output to disk. Instead, this information is stored in the system's RAM. This generally allows a web tool to execute faster than one where all outputs are written to disk.

Learn more about the in_memory workspace

Caution:

Do not write output datasets to in_memory if you plan on configuring your service so that your output data is drawn by a map image layer.

When you choose to view your web tool output as a map image layer, it is important to understand that there are two services created on the server: the geoprocessing service and the map service. These two services execute independently of each other. When the tool executes, the geoprocessing service executes first. The map service then executes to draw the output. Because of this execution order, the resultant map service needs datasets on disk produced by the geoprocessing service.

When using the output map image layer or a tool that must write its output to disk, there are variables that provide control over output locations. Two variables, %scratchGDB% and %scratchFolder% can be used in your model to direct output to a file geodatabase or a folder. These variable exist in ArcGIS Pro and as web tools, and you can create output in them.

Note:

If you've written your model with full paths to data on disk, the sharing process updates the output paths in the model to reflect one of these variables depending on the data output type. The sharing process always maintains a path written to in_memory.

Get started with ModelBuilder

If you are unfamiliar with ModelBuilder, the following table lists topics that will help you get started writing models:

Help topicContent

What is ModelBuilder?

ModelBuilder vocabulary

These topics provide an introduction to ModelBuilder.

Create a model tool

This tutorial provides the basics of creating a tool in ModelBuilder. A model tool is a model that exposes variables as parameters.