<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Match Symbology to a style? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/match-symbology-to-a-style/m-p/1253063#M64804</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jan 2023 20:47:49 GMT</pubDate>
    <dc:creator>Davec43</dc:creator>
    <dc:date>2023-01-30T20:47:49Z</dc:date>
    <item>
      <title>Match Symbology to a style?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/match-symbology-to-a-style/m-p/1252473#M64733</link>
      <description>&lt;P&gt;I've created a list of the layers in the map and I'm trying to then use that list to match symbology to a style. Is it possible? When I try I get an error.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy

import random
from itertools import groupby
from collections import defaultdict
aprx = arcpy.mp.ArcGISProject("CURRENT")
act_map = aprx.activeMap
map1 = aprx.listMaps("Map1")

layer = act_map.listLayers()
lyr_list = []
for position in range(0, len(layer)):
    lyr_name = layer[position].name
    lyr_list.append(lyr_name)

arcpy.management.MatchLayerSymbologyToAStyle(lyr_list, "$feature.Type", r"\\Path\ArcGIS_Styles.stylx")

Traceback (most recent call last):
  File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 10200, in MatchLayerSymbologyToAStyle
    raise e
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 10197, in MatchLayerSymbologyToAStyle
    retval = convertArcObjectToPythonObject(gp.MatchLayerSymbologyToAStyle_management(*gp_fixargs((in_layer, match_values, in_style), True)))
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in &amp;lt;lambda&amp;gt;
    return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 18:56:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/match-symbology-to-a-style/m-p/1252473#M64733</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-01-27T18:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Match Symbology to a style?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/match-symbology-to-a-style/m-p/1253058#M64803</link>
      <description>&lt;P&gt;MatchLayerSymbologyToAStyle takes a layer as an input parameter, but you are trying to pass a list of layers into the tool, which will not work. Your MatchLayerSymbologyToAStyle has to be part of your loop.&lt;/P&gt;&lt;P&gt;Additionally, lines 10-14 are not needed. listLayers() gives you everything you need, so constructing a list of layer names is extra work. I would remove lines 10-16 and use this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;layers = act_map.listLayers()
for lyr in layers:
    arcpy.management.MatchLayerSymbologyToAStyle("$feature.Type", r"\\Path\ArcGIS_Styles.stylx") &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, act_map is referring to your current active map in your ArcGIS Pro project. This can sometimes be annoying if you have multiple maps in a project and don't have the right one open. I usually prefer to just define the map by its name. You do that with,&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;map1 = aprx.listMaps("Map1")&lt;/PRE&gt;&lt;P&gt;But never actually use this variable. If map1 is what you actually want to use, I'd replace act_map with map1.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 20:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/match-symbology-to-a-style/m-p/1253058#M64803</guid>
      <dc:creator>DanielMiranda2</dc:creator>
      <dc:date>2023-01-30T20:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Match Symbology to a style?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/match-symbology-to-a-style/m-p/1253063#M64804</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 20:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/match-symbology-to-a-style/m-p/1253063#M64804</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-01-30T20:47:49Z</dc:date>
    </item>
  </channel>
</rss>

