Apply Symbology From Layer (Data Management)
Summary
This tool applies the symbology from a layer to the Input Layer. It can be applied to feature, raster, network analysis, TIN, and geostatistical layer files or layers in the ArcMap table of contents. This tool is primarily for use in scripts or ModelBuilder.
Illustration
Usage
-
In model or script use, the Symbology Layer most often comes from a layer file. The Make Feature Layer tool or the Make Raster Layer tool can be used to create a layer to apply symbology. Feature, raster, and TIN layers can also be created by right-clicking the layer in the ArcMap table of contents and clicking Save As Layer File. The layer is then saved in the desired location.
-
The Symbology Layer must match the data type of the Input Layer; for example, a feature layer cannot be applied to a raster layer and vice versa.
-
The Symbology Layer can only be applied to features of the same geometry; for example, a point layer cannot be applied to a polygon layer.
-
The field in the Input Layer that will be displayed must have the same name as that of the corresponding Symbology Layer field. If this field is missing, the output data is drawn with default symbology.
- You can name a field in the Input Layer to match the Symbology Layer field name using the Make_Feature_Layer tool.
3D properties such as extrusion and offset are not supported with this tool.
-
Symbology methods can be dynamic; for example, the symbology is updated to reflect the characteristics of the Input Layer as shown in the illustration below. In this example, the five class Natural Breaks classification method from the Symbology Layer is applied to the Input Layer and the range values are updated to reflect the Shape_Area values of the Input Layer.
The following methods are dynamic:
- Unique values symbology to a feature
- The unique values are updated to reflect the Input Layer.
- If you do not want the unique values classification to be updated, then choose the <all other values> default symbol in the Symbology Layer.
- Graduated color symbology to a feature
- The range values are updated to the values of the Input Layer.
- If you do not want your range output to be updated, then choose manual classification.
- Classified value rendering to a raster
- The range values are updated to reflect the values of the Input Layer.
- If you do not want your range output to be updated, then choose manual classification.
- Unique values symbology to a feature
Syntax
Parameter | Explanation | Data Type |
in_layer |
The layer to which the symbology will be applied. | Feature Layer;Raster Layer; TIN Layer;Network Analysis Layer;Geostatistical Layer |
in_symbology_layer |
The symbology of this layer is applied to the Input Layer. | Feature Layer; Raster Layer;TIN Layer; Network Analysis Layer;Geostatistical Layer |
Code Sample
The following Python window script demonstrates how to use the ApplySymbologyFromLayer function in immediate mode.
import arcpy arcpy.ApplySymbologyFromLayer_management("sf_points", "sf_points_water.lyr")
The following stand-alone script shows how to use the ApplySymbologyFromLayer function in scripting.
# Name: ApplySym.py # Purpose: apply the symbology from one layer to another # Import system modules import arcpy from arcpy import env # Set the current workspace env.workspace = "C:/data" # Set layer to apply symbology to inputLayer = "sf_points.lyr" # Set layer that output symbology will be based on symbologyLayer = "water_symbols_pnt.lyr" # Apply the symbology from the symbology layer to the input layer arcpy.ApplySymbologyFromLayer_management (inputLayer, symbologyLayer)