Match Layer Symbology To A Style (Data Management)

Summary

Creates unique value symbology for the input layer based on the input field or expression by matching input field or expression strings to symbol names from the input style.

Usage

  • Unique values symbology is created for the input layer. If the layer is in the current map, the layer is updated. Otherwise, the symbolized layer is added to the map. Regardless, existing layer symbology is overwritten.

  • Unique values symbol classes are created by the Match Values (Field or Expression) parameter and symbolized with a symbol, from the input Style parameter, whose name matches the field value or resultant expression value. When the tool matches values from a single field and that field is a subtype field or has a coded value domain, the symbols are matched to the subtype or domain description.

  • Point and multipoint feature layers are matched with point symbols in the style. Polyline feature layers are matched with line symbols. Polygon feature layers are matched with polygon symbols. Multipatch feature layers are matched with mesh symbols.

  • When no match is found, the symbol class is drawn with the default symbol for all other values.

Syntax

arcpy.management.MatchLayerSymbologyToAStyle(in_layer, match_values, in_style)
ParameterExplanationData Type
in_layer

The input layer or layer file to which matched symbols are applied as unique values symbol classes. The input layer can contain point, line, polygon, multipoint, or multipatch symbology. Existing symbology on the layer is overwritten.

Feature Layer
match_values

The field or expression on which the input layer is symbolized. The field values or resultant expression values are matched to symbol names in the specified style to assign symbols to the resulting symbol classes.

Calculator Expression
in_style

The style containing symbols with names matching the field or expression values.

String

Derived Output

NameExplanationData Type
out_layer

The updated symbolized layer.

Feature Layer

Code sample

MatchLayerSymbologyToAStyle example (Python window)

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

import arcpy
arcpy.management.MatchLayerSymbologyToAStyle("Streets", "$feature.RoadClass", 
                                             r"C:\RoadClasses.stylx")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics