NOTE: Since processes within your published model or script execute on the server where all data types are available, you can use any data type for model or script processes, as illustrated below. Only the input and output parameter data types are limited. Any type of data that can be accessed by the server can be used by your model or script processes.
The following table summarizes key input parameter data types for the three clients.
Input parameter data type |
Supported on ArcGIS Desktop clients? |
Supported on ArcGIS Explorer client? |
Supported on web application clients? |
Feature Set |
Yes |
Yes |
Yes |
Record Set |
Yes |
Yes |
Yes |
Feature Class |
No (but Feature Class input is supported indirectly with the Feature Set data type) |
No |
No |
Table |
No (but Table input is supported indirectly with the Record Set data type) |
No |
No |
Raster |
Yes |
No |
No |
Standard types (such as Long, Double, Boolean, Date, String) and Linear Unit (for example, "1,000 meters") |
Yes |
Yes |
Yes |
File (such as a .zip or .xml file) |
Yes |
Yes |
Yes |
Layer (any type of layer; for example, Feature Layer, Raster Layer, Network Analyst Layer) |
Only those layers found in a result map service or source map document. |
Only those layers found in a result map service or source map document. |
Only those layers found in a result map service or source map document. |
For any input data type not in the above list, one of two things will occur when you publish your model or script.
- The tool will be published but the data type will be converted to a string data type containing the string representation of the data.
- The tool will not publish and you'll receive an error. Data types that result in publishing errors are the following:
- Any geodataset (such as Feature Class) or table except for raster
- Data element
- Value table/Multivalue
- Model variables that are lists
Feature classes and tables
Feature Class and Table data types are not supported as input parameters because they rely on large software libraries that cannot be installed with lightweight clients such as ArcGIS Explorer and Web applications. Because of this, geoprocessing contains two lightweight data types,
Feature Sets and Record Sets, which you can substitute for Feature Class and Table data types.
Feature Sets allow all Web clients to interactively digitize features on a map. In ArcGIS Desktop, the Feature Set data type additionally allows you to input an existing feature class, as illustrated below. Feature classes are allowed on ArcGIS Desktop because the required software libraries are available (that is, it's a heavyweight client). Similarly, Record Sets allow all clients to interactively create table records, and in ArcGIS Desktop, you can additionally specify an existing table.
Learn more about Feature and Record Sets
Raster datasets
Geoprocessing services that have Raster dataset inputs only work on ArcGIS Desktop clients. On an ArcGIS Explorer client, the service cannot be added as a task. In Web applications, the service will return an error.
The following table summarizes key output parameter data types for the three clients. Following this table are notes about each data type.
Output parameter data type |
Supported on ArcGIS Desktop clients? |
Supported on ArcGIS Explorer client? |
Supported on web application clients? |
Feature Class |
Yes |
Yes |
Yes |
Feature Layer |
Yes |
Yes |
Yes |
Raster |
Yes |
No—can only be displayed using a result map service |
No—can only be displayed using a result map service |
Raster Layer |
Yes |
No |
No |
Geodataset (other than feature class or raster) |
No—can only be displayed using a result map service |
No—can only be displayed using a result map service |
No—can only be displayed using a result map service |
Table |
Yes |
No—services that have a table data type as an output parameter will not be shown in the list of available tasks |
Yes |
Standard types (such as Long, Double, Boolean, Date, String) and Linear Unit (for example, "1,000 meters") |
Yes—viewed in the service result found in the Results tab of the ArcToolbox window |
Yes—viewed in the Task Result |
Yes |
File |
Yes |
Yes |
Yes |
For any data type not in the above list, one of two things will occur when you publish your model or script.
- The tool will be published but the data type will be converted to a string data type containing the string representation of the data.
- The tool will not publish and you'll receive an error.
NOTE: If you are using a result map service to draw your output data, your task can output any geodataset. The result map service will draw the geodataset.
Feature Class
The Feature Class data type is supported as an output data type. When you publish a model or script, your tool is scanned; if an output Feature Class is found, it is turned into an output Feature Set and this Feature Set is transported back to the client. This transformation occurs behind the scenes; your model or script is unchanged. It only occurs with output feature classes because the transformation occurs on the server, which has all the necessary software libraries needed to perform the transformation. So, technically speaking, feature classes are not supported for output; they are allowed because ArcGIS Server knows how to transform them to the supported Feature Set data type.
Feature layers
A feature layer references a feature class on disk and supports a set of selected features that result from an attribute or spatial query. You create feature layers using the
Make Feature Layer tool and perform queries using the
Select Layer By Attribute and
Select Layer By Location tools. It is not uncommon for geoprocessing tasks to output feature layers containing selections.
When ArcGIS Server encounters an output feature layer, the selected features are converted to a feature class and only the selected features are transported back to the client.
NOTE: Output feature layers do not work in result map services.
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. Feature layers are transient objects, held in memory for the duration of task execution. Once the task completes these in_memory feature layers disappear. If the result map service references the same feature class found in the layer, all information about the selected features (that is, the result of your task) will be gone when the map service draws, and the result map service draws all features. If you need a map service to draw selected features in a layer, you must first save these selected features to a feature class using the
Copy Features tool, using your feature layer as input. Copy Features will only copy the selected features in the layer. You can then draw the copied features with a result map service.
Raster datasets
Raster datasets are supported as output only on ArcGIS Desktop clients.
Raster layers
Like feature layers, you can output a raster layer only on ArcGIS Desktop clients. When ArcGIS Server encounters an output raster layer, the raster is transported back to the client. Output raster layers do not work in result map services for the same reason that feature layers do not work, as noted above.
Other layers
Only feature layers and raster layers are supported for output (and, as mentioned, raster layers are only supported for ArcGIS Desktop clients). All other kinds of layers, such as NetCDF layers, Network Analysis layers, and Geostatistic Analysis layers, are not supported.
Other geodatasets
Any output geodataset data type besides Feature Class or Raster (such as TIN or Terrain) cannot have its data transferred back to the client. However, your geoprocessing service can have a result map service to display the data, and the result of your geoprocessing service will be a map-service layer that can be drawn on any client.
Table
The Table data type, like the Feature Class data type, is also supported; it is transformed into a Record Set for transport back to the client.
If the model or script you want to publish has unsupported input or output data types, or the data type is converted to a string, you must modify your model or script so that it only uses the supported input and output data types. There are two general strategies you can employ:
- Use the string representation.
- Convert data to a file.
Using the string representation
Every data type has a string representation, as discussed in
data types for geoprocessing tool parameters.
If an input to your model is one of the data types that is converted to a string when published to ArcGIS Server, you can modify your model to accept string input and then convert the string to your desired data type. The following demonstration shows you how to do this conversion. This example first shows converting a data type's value to a string, which is the opposite of what you need to do for your model but demonstrates an important concept: all data types have a string representation. The second part of the example shows how to convert a string to a data type value—the method you would use in your service.
The data type used for demonstration is Areal Unit.
The first part of this demonstration determines the string format of an areal unit.
- Create a new model.
- Create a variable with an Areal Unit data type and rename it "Input AU".
- Add the Calculate Value tool.
- Double-click Calculate Value to open its dialog box. For the Expression parameter, enter "%Input AU%". This instructs Calculate Value to read the contents of the variable Input AU.
Learn more about variable substitution For the Data type parameter, choose String, as illustrated below.
- Optionally, you can make the Input AU variable a precondition to Calculate Value. A precondition means that the variable must contain a value before the tool executes. Precondition connectors are shown as dashed lines, as illustrated below.
Learn more about setting preconditions
- Double-click the Input AU variable and set its value to ,000 Square Meters.
- Click OK.
- Run the model. Double-click output_value and examine its value. The value is the string representation of the areal unit, as illustrated below. Note how the string representation does not contain a space between "square" and "meters."
As demonstrated above, all data type values have a string representation. You can use Calculate Value to view the string representation of any data type. For example, you could input a Spatial Reference variable into Calculate Value to view its string representation.
Learn more about the string representation of a data type value
The following steps show you how to convert a string variable into another data type. The steps are the same as above except the input variable is a String and the output is an Areal Unit.
- Create a new model.
- Create a variable with a String data type and rename it "Input AU String".
- Add the Calculate Value tool.
- Double-click Calculate Value to open its dialog box. For the Expression parameter, enter "%Input AU String%". This instructs Calculate Value to read the contents of the variable Input AU String.
Learn more about variable substitution For the Data type parameter, choose Areal Unit, as illustrated below.
- Optionally, you can make the Input AU String variable a precondition to Calculate Value. A precondition means that the variable must contain a value before the tool executes. Precondition connectors are shown as dashed lines, as illustrated below.
Learn more about setting preconditions
- Double-click the Input AU String variable and set its value to "1000 squaremeters".
- Click OK.
- Run the model. Double-click output_value and examine its value. The value is Areal Unit, as illustrated below. The data type of output_value is actually Any value, not Areal Unit. A data type of Any value is a generic data type that can be connected to any tool parameter.
(This conversion technique is also demonstrated in the Select Layer By Area model found in
GP Service example: Selecting data.)
The illustration below shows a model that uses the
Simplify Building tool, which takes an areal unit as input. Because Areal Unit is not a supported input parameter data type for geoprocessing services, the model's input parameter (Minimum Area) is a string that is converted to an areal unit using the above method. The variable output_value is connected to the Minimum Area parameter of the Simplify Building using ModelBuilder's Add Connection tool
.
Learn more about connecting variables to tools
Using this technique requires that the user of your tool enter the correct string. For example, if "1000 square meters" (instead of "1000 squaremeters") is input to Calculate Value, the resulting Areal Unit will be empty. Capitalization does not matter—that is, SquareMETERS and squareMeters are equivalent.
If you want to provide more error checking in the process of converting a string to a data type, you can write a script tool to do data type conversion and add error checking to the script. The Python code below shows the basic idea.
import arcgisscripting
gp = arcgisscripting.create()
# Get the string and call SetParameterAsText on the output
#
in_string = gp.GetParameterAsText(0)
# do error checking here
gp.SetParameterAsText(1, in_string)
As illustrated below, the input data type of the tool would be String, and the output data type would be your target data type (such as Areal Unit). The output parameter type is Derived.
Learn more about creating script tools
Converting data to a file
A technique you can use for folder-based workspaces (file geodatabase, coverages, and shapefiles) is to instruct your user to use the Zip compression utility to make a .zip file out of a workspace, then input the .zip file to your tool. Within your geoprocessing service, you can use the unzip script (see below) to unzip the file into a workspace and proceed from there. The same is true for outputs—you can create a .zip file of a workspace and use that for output.
Below are links to two Python scripts, zip.py and unzip.py.
- zip.py takes an input workspace (a file geodatabase, a folder containing coverages, or a folder containing shapefiles—everything but a personal or enterprise geodatabase) and an output file name and creates a compressed zip file. You should add the .zip suffix to the output filename—the script doesn't automatically add the suffix.
The parameter properties are as follows:
Label |
Data Type |
Type |
Direction |
Input workspace |
Workspace |
Required |
Input |
Output file |
File |
Required |
Output |
- unzip.py takes a .zip file, an output location (an existing folder), and an output name (which becomes a new folder) and writes the contents to the new folder. If the .zip file contains a file geodatabase, append .gdb to the output name.
Label |
Data Type |
Type |
Direction |
Input zipfile |
File |
Required |
Input |
Output Location |
Workspace |
Required |
Input |
Output Name |
String |
Required |
Input |
Output Path |
Workspace |
Derived |
Output |
For an example of using these zip utilities, see
GP Service example: Clip and ship and
GP Service example: Data on demand.