Models can only use certain input and output parameter data types, as discussed in detail in
Key concepts for geoprocessing services and
Input and output data types.
For existing models, the most common modification you need to make is to change input feature class model variables (which are not supported by ArcGIS Server) to feature set variables (which are supported by ArcGIS Server).
Learn more about feature sets.
Some data types, such as TIN, are not allowed for parameters and the model will not publish. You will receive an error message when publishing, as illustrated below.
Other parameter data types will publish, but they will be transformed to a String data type. For example, an Areal Unit data type will become a String data type in the published task. If your model has a converted data type as an input parameter, you will need to change its type to String and convert it to your desired data type within your model.
Learn more about converting to and from String data types.
When your task executes, ArcGIS Server creates a job directory where you can write the intermediate and output data of your model, as illustrated below. You
must write your intermediate data and output data to either the scratch folder or the scratch geodatabase.
Rules for intermediate data
- In ModelBuilder, right-click any intermediate data variable and choose Managed.
NOTE: Do not set output variables to Managed, only intermediate variables.
- Use variable substitution ("%scratchworkspace%") for pathnames as in the following examples:
%scratchworkspace%/templines.shp
%scratchworkspace%/scratch.gdb/outWatershed
Write data to memory as in the following example:
in_memory/tempdata
Be sure you understand the limitations of using in_memory before using this location.
Learn more about the in_memory workspace.
Rules for output data
Output data must be written to the following:
- %scratchworkspace%/<dataset>
- %scratchworkspace%/scratch.gdb/<dataset>
- in_memory/<dataset> if, and only if, there is no result map service for your geoprocessing service. When you use a result map service, it's important to realize that there are two services—the geoprocessing service and the result map service. These two services execute independently of each other. When the task executes, ArcGIS Server executes the geoprocessing task first and then executes the result map service to draw the output of the geoprocessing service. Because of this execution order, the result map service needs datasets on disk produced by the geoprocessing service. This means that the output of the tasks in the geoprocessing service must be physical datasets on disk, not layers or in_memory datasets.
NOTE: Do not make your output data managed.
NOTE: Do not write output data to in_memory if you have a result map service.
NOTE: Be sure you understand the limitations of using in_memory before writing data to this location.
Learn more about the in_memory workspace.
NOTE: Do not set the scratch workspace for any model processes. Do not set the scratch workspace for the model.
Using the toolshare folder structure
When you are developing tools and map documents for publishing, you should use the
toolshare folder structure to gather together your resources—toolboxes, map documents, data, and documentation. This folder structure contains a scratch folder with a scratch file geodatabase, just like the geoprocessing service job directory that ArcGIS Server creates for your task, as illustrated below. By using the toolshare folder structure and setting your workspace to the scratch folder, you are emulating ArcGIS Server, which makes testing and debugging your tool much easier.