Skip To Content

Apply Symbology From Layer

Summary

This tool applies the symbology from a layer or layer file to the input. It can be applied to feature, raster, network analysis, TIN, and geostatistical layers.

Usage

  • 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 can only be applied to features of the same geometry; for example, point symbology cannot be applied to a polygon layer.

  • 3D properties such as extrusion and offset are not supported with this tool.

  • If the input is a feature class or dataset path, this tool will automatically create and return a new layer with the result of the tool applied.

  • You can choose to maintain or update the symbology via the Update Symbology Ranges by Data parameter, or leave the default. By default, symbology methods can be dynamic; for example, the symbology is updated to reflect the characteristics of the input layer as shown below. 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.

    Example of Apply Symbology From Layer

    The following methods are dynamic:

    • Unique values symbology to a feature
      • The unique values are updated to reflect the input layer's values.
      • If you do not want the unique values classification to be updated, 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, 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, choose manual classification.

Syntax

ApplySymbologyFromLayer_management (in_layer, in_symbology_layer, {symbology_fields}, {update_symbology})
ParameterExplanationData Type
in_layer

The layer to which the symbology will be applied.

Layer
in_symbology_layer

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

Layer
symbology_fields
[[field_type, source_field, target_field],...]
(Optional)

Fields from the input layer that match the symbology fields used in the symbology layer. Symbology fields contain three properties:

  • Field type—Determines if the field is the symbology value, normalization, or other type.
  • Source field—The symbology field used by the symbology layer. Use "#" if you do not know the source field and want to use the default.
  • Target field—The field from the input layer to use when applying the symbology.

Specify this parameter as a list: [[Field type, Source field, Target field], ...]. For example, [["VALUE_FIELD", "#", "MyValueField"], ["NORMALIZATION_FIELD", "#", "MyNormalizationField"]].

Value Table
update_symbology
(Optional)

Specifies how symbology ranges are updated.

  • DEFAULTSymbology ranges will be updated, except for the following situations:
  • UPDATEUpdate the symbology ranges.
  • MAINTAINMaintain the symbology ranges.
String

Code sample

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)

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics