ArcGIS Server Banner

Preparing map documents containing tool layers

Preparing map documents containing tool layers

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback

Map documents containing tool layers can be published to ArcGIS Server as a geoprocessing service. Each tool layer in the map document becomes a task within the geoprocessing service. Tool layers contain sublayers for each output of your tool. This topic describes how to configure and prepare a map document containing tool layers for publication, as follows:

The steps below assume that you have built a model suitable for publishing to ArcGIS Server.

Re-create tool layers when underlying tool changes

NOTE: If, after creating a tool layer, you change the parameters of the model on which it is based, you must delete and re-create the tool layer. If you change the schema of a feature set, you must also re-create the tool layer.

Tool layers contain the definition of the parameters of the underlying tool. If you change the parameters in any way, you must delete and re-create the tool layer so that the new tool layer contains the new parameter definitions. It is not necessary to re-create the tool layer if you change the model or script logic—it is only necessary when you change anything related to input and output parameters.

Set geoprocessing options

  1. In ArcMap, click the Tools menu, click Options, then click the Geoprocessing tab.
  2. Check that you have not set the scratch workspace environment at the tool level, as follows:

Set the scratch workspace environment

In the above section, you made sure that the scratch workspace was not set at the tool or model process level. However, you do need to set the scratch workspace at the application level, as follows:

  1. In the ArcToolbox window, right-click the ArcToolbox entry and click Environments.
  2. In the Environment Settings dialog box, expand General Settings.
  3. For the Scratch workspace environment setting, enter the pathname to a system folder.

NOTE: Do not set the scratch workspace to a geodatabase.

NOTE: Setting the scratch workspace is not necessary if your model does not output datasets on disk.

Optionally, you can click the Tools menu in ArcMap, click Options, click the Geoprocessing tab, then click Environments and set the scratch workspace.

What happens if I do not set the scratch workspace environment?

If you leave the scratch workspace blank, the system default workspace is used. This default workspace is in the Documents and Settings folder. Windows will mangle the pathname to the default workspace as follows:

C:\DOCUME~1\<username>\LOCALS~1\Temp\

After running your tool, your outputs will be written to this location. When you publish your map document, ArcGIS Server will look for data in this location and won't find it because the pathname is mangled, and your document will not publish.

Create tool layers

Creating a tool layer

To create a tool layer, drag and drop your tool from ArcToolbox onto the ArcMap table of contents. (Optionally, you can drop the tool onto the map display). If the outputs of the tool exist when the tool layer is created (for example, if you ran the tool from the ArcToolbox window), the tool layer will contain sublayers for each output, as illustrated below. If the outputs do not exist, no sublayers will be created.

When tool layer is created, there may or may not be sublayers

Open and run tool layers

After creating the tool layer, you need to run the tool layer in order to create all outputs of the tool.

  1. Right-click the tool layer and click Open.
  2. Provide the necessary inputs for your tool and click OK to run.
  3. After the tool finishes running, the tool layer should contain a sublayer for each output of the tool.

The illustration below shows the tool dialog for the Create Watershed Tool found in the Watershed example.

Create Watershed Polygon tool

Change layer symbology if needed

If you are creating a geoprocessing service with a result map service, the symbology defined for each sublayer in your tool layer will be used by the map service to draw results.

To change the symbology of a sublayer in the tool layer, right-click the sublayer, click Properties, and click the Symbology tab.

Learn more about symbolizing output data

Remove unneeded layers

Before publishing your map document, you should remove all unneeded layers. For example, you may have layers from previous runs of your model or layers used to define feature set schemas. You should only keep tool layers and those layers used by your models.

Ensure layers are connected

If you are publishing a geoprocessing service with a result map service, every layer within the map document must be a valid layer—it cannot be a disconnected layer, as illustrated below. Otherwise, the result map service cannot draw your data.

Disconnected layer

Tool layers contain a sublayer for each output of your tool. Data for these sublayers must exist for your data to be drawn.

NOTE: This is a requirement only if you are using a result map service.

If you are not using a result map service, you can publish with disconnected layers. Typically, disconnected layers are the result of writing data to memory.

Sublayers appear after tool layer is run

Note that services have a recycling schedule for automatically restarting services. By default, restarting occurs every 24 hours at midnight. If data is deleted after publishing, your result map service will not be able to draw your data.

See Also

  • Key concepts for geoprocessing services