Creating a layer symbology file
In a model or script, you can specify how output data is to be symbolized when added to the ArcMap,ArcGlobe, or ArcScene table of contents using one of the following techniques:
- In ModelBuilder, set the Layer Symbology property of the output variable.
- For a script tool, set the Symbology property of an output parameter.
- Use the Apply Symbology From Layer tool in your script or model.
All three techniques use a layer file (.lyr) that defines the symbology used to draw output data when it is added to the display. When a layer file is used to define the symbology of tool outputs, it is referred to as a layer symbology file.
Creating a layer symbology file for ModelBuilder
- Start ArcMap and edit your model in ModelBuilder.
- Run your model in ModelBuilder.
- Add the desired output variable to the display by right-clicking the variable and clicking Add To Display. This creates a new layer in the ArcMap table of contents.
- In ArcMap, double-click the new layer to open its properties, then click the Symbology tab. Change the symbology to how you want the model output to be displayed.
- Click OK.
Right-click the layer and click Save As Layer File.
- Alternatively, you could run the Save To Layer File tool.
- In ModelBuilder, right-click the output variable and choose Properties.
- Click the Layer Symbology tab and enter the path to the .lyr file you saved above.
- Save your model.
If you are using a classification (such as unique values) to symbolize your data, you can choose to have the output data reclassified, causing the legend to change when the data is refreshed. See the sections below for information on how to force reclassification.
The next time you run your model, either within ModelBuilder from the tool dialog box, the output will be symbolized using the symbology defined in the .lyr file.
The layer file must exist each time the model is run. If it does not exist, the model still runs, but the data is drawn with the default symbology.
To create a layer symbology file to use with the output of a script tool:
- Execute your script tool to add the output layers to the table of contents.
- Follow the steps above to change symbology of the output layers and save a .lyr file.
- In the Catalog window:
- Right-click the script tool and choose Properties.
- Click the Parameters tab.
- Select the output parameter.
- In the Parameter Properties section, set the Symbology property to the layer file saved above.
- Click OK.
The next time you run your script the output will be symbolized using the symbology defined in the .lyr file.
The layer file must exist each time the script is run. If it does not exist, the script still runs, but the data is drawn with the default symbology.
Setting layer symbology using unique value category
When you are symbolizing data in categories, the state of the <all other values> check box, illustrated in the table below, determines how the data will be symbolized.
Checked—The data will be symbolized as specified. The legend is unchanged. No new categories are created. This is referred to as static symbology.
Unchecked—The data will be read, and new categories will be created based on the data. The legend will change. This is referred to as dynamic symbology.
Following are details about how data in categories is drawn when using a layer symbology file or the Apply Layer From Symbology tool.
If your symbology layer file defines unique categories like the above illustration, there are rules that determine how the output is drawn.
- The output data must have the unique value field (CODE in the above illustration). If this field is missing, the output data is drawn with default symbology. (You can map a field on the dataset to the symbology field using Make Feature Layer tool.)
- If the unique value field exists on the output data, its values are read from the output data to create a list of unique values. You can think of this list as containing two types of values:
- Matched values are those that are found in the symbology definition.
- Unmatched values are those that are not found in the symbology definition.
- If <all other values> is checked, unmatched values are drawn with the symbol defined for <all other values> and the legend is not updated, as illustrated above. This is referred to as static draw because the legend is not updated.
- If <all other values> is unchecked, values are symbolized using the following rules:
- If the Value Field is an integer or text field
- Matched values will use the symbol as defined in the classification (the existing symbol).
- Unmatched values will use a color from the color ramp and the symbol defined by <all other values> such as a thick or thin line. The legend is updated to contain all matched and unmatched values.
- If the unique value field is a long or double field
- Both matched and unmatched values will use a color from the color ramp and the symbol defined by <all other values>. The legend is updated to contain all matched and unmatched values.
- If the Value Field is an integer or text field
- The limit for the number of unique values is 500.
Setting layer symbology using quantities
You can also symbolize output data by quantities. The screen shot below shows the properties of a graduated color quantity. The value field is Score, and the number of classes is five.
If your symbology layer file defines quantities like the above illustration, there are a few rules that apply.
The output data must have the value field (Score in the above illustration). If this field is missing, the output data is drawn with default symbology. (You can map a field on the dataset to the symbology field using Make Feature Layer tool.)
If the value field exists on the output data, the values will be read and classified into the number of classes specified (5 in the above illustration). The classes will be drawn using the specified color ramp.
You can force the same classification to be used regardless of the values found on the output data:
- Select Graduated colors and a field value and click Classify.
- From the classification method, choose Manual.
Enter the break values to set the classification.