Apply Symbology From Layer

Title  Apply Symbology From Layer

Summary

Geoprocessing tool that applies the symbology from a specified layer to the input.


Usage


Syntax

Parameter Explanation
in_layer

The layer to which the symbology will be applied.

in_symbology_layer

The symbology of this layer is applied to the input layer. Both .lyrx and .lyr files are supported.

update_symbology (Optional)

Specifies how symbology ranges are updated.Default—Symbology ranges will be updated, except for the following situations; when the input layer is empty, when the symbology layer uses class breaks (for example, graduated colors or graduated symbols), and the classification method is manual or defined interval, or when the symbology layer uses unique values, and the Show all other values option is checked.Update ranges—Update the symbology ranges.Maintain ranges—Maintain the symbology ranges.

Code Samples

ApplySymbologyFromLayer example 1 (Python window)

The following Python window script demonstrates how to use the ApplySymbologyFromLayer function in immediate mode.


import arcpy
arcpy.env.workspace = "C:/data.gdb"
arcpy.ApplySymbologyFromLayer_management("sf_points", "sf_points_water.lyrx")

                    

ApplySymbologyFromLayer example 2 (stand-alone script)

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

# Set the current workspace
arcpy.env.workspace = "C:/data.gdb"

# Set layer to apply symbology to
inputLayer = "sf_points"

# Set layer that output symbology will be based on
symbologyLayer = "water_symbols_pnt.lyrx"

# Apply the symbology from the symbology layer to the input layer
arcpy.ApplySymbologyFromLayer_management(inputLayer, symbologyLayer)

                    

ApplySymbologyFromLayer example 3 (stand-alone script)

The following stand-alone script shows how to use the ApplySymbologyFromLayer function in scripting.


# Name: ApplySym2.py
# Purpose: apply the symbology from one layer to another

# Import system modules
import arcpy

# Set the current workspace
arcpy.env.workspace = "C:/data.gdb"

# Set layer to apply symbology to
inputLayer = "InlandEmpireBlocks"

# Set layer that output symbology will be based on
symbologyLayer = "USCensusBlocks.lyrx"

# The symbology layer is symbolized by population normalized by area.
# Symbolize the input by Pop2014 field normalized to Square Miles
symbologyFields = [["VALUE_FIELD", "#", "Pop2014"], 
                   ["NORMALIZATION_FIELD", "#", "SQ_MILES"]]

# Apply the symbology from the symbology layer to the input layer
arcpy.ApplySymbologyFromLayer_management (inputLayer, symbologyLayer, symbologyFields)

                    

Tags

Credits

Use limitations