<?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: Change symbology of an existing layer through arcpy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1273625#M67397</link>
    <description>&lt;P&gt;Seems to be a common issue.&amp;nbsp; MXDs did have a refreshActiveView which I cant see for Pro.&lt;BR /&gt;This hack might be worth a go:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/283750/why-would-arcpy-applysymbologyfromlayer-tool-not-work-in-arcgis-pro-python-windo" target="_blank" rel="noopener"&gt;https://gis.stackexchange.com/questions/283750/why-would-arcpy-applysymbologyfromlayer-tool-not-work-in-arcgis-pro-python-windo&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"I found that passing a layer object through the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ApplySymbologyFromLayer()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function, as the first arg, does not work. For whatever reason, you should pass a string through it. So basically change your line from:"&lt;/P&gt;&lt;P&gt;in_layer = arcpy.ApplySymbologyFromLayer_management(in_layer,in_symbology_layer,update_symbology="MAINTAIN")[0]&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;in_layer = arcpy.ApplySymbologyFromLayer_management(str(in_layer),in_symbology_layer,update_symbology="MAINTAIN")[0]&lt;/P&gt;</description>
    <pubDate>Thu, 30 Mar 2023 16:17:20 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2023-03-30T16:17:20Z</dc:date>
    <item>
      <title>Change symbology of an existing layer through arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1273586#M67389</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I've created a pythonscript contained in an ArcGIS Pro Toolbox (atbx), where I'd like to change a layer's symbology. I know it's possible to define a layer's symbology through the script parameters in the toolbox by setting the output layer as derived and also defining a lyrx file either as a property ofthe parameter or in the script it self. But in my case, the layer that I want to change symbology for is already added in the ArcGIS Pro project and is being used in a task. Therefore it's not possible for me to remove and add the layer as a derived parameter, since the task-resource for that layer will be broken.&lt;/P&gt;&lt;P&gt;I've tried using arcpy.ApplySymbologyFromLayer, but that doesn't work. There are no errors, but the layer symbology does not change. The lyrx-file works when importing symbology manually in Pro. What's the best practice here? Does anyone know what might be causing ApplySymbologyFromLayer to not have any effect?&amp;nbsp;&lt;/P&gt;&lt;P&gt;One option is to define the new symbology based on the CIM-class, for example CIMUniqueValueRenderer. I've almost created the symbology this way, but I'm not able to set the defaultLabel. The symbology should show only to groups, &amp;lt;Null&amp;gt; and "All other Values". Has anyone got any experience with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 15:09:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1273586#M67389</guid>
      <dc:creator>TorbjørnDalløkken2</dc:creator>
      <dc:date>2023-03-30T15:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of an existing layer through arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1273625#M67397</link>
      <description>&lt;P&gt;Seems to be a common issue.&amp;nbsp; MXDs did have a refreshActiveView which I cant see for Pro.&lt;BR /&gt;This hack might be worth a go:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/283750/why-would-arcpy-applysymbologyfromlayer-tool-not-work-in-arcgis-pro-python-windo" target="_blank" rel="noopener"&gt;https://gis.stackexchange.com/questions/283750/why-would-arcpy-applysymbologyfromlayer-tool-not-work-in-arcgis-pro-python-windo&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"I found that passing a layer object through the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ApplySymbologyFromLayer()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function, as the first arg, does not work. For whatever reason, you should pass a string through it. So basically change your line from:"&lt;/P&gt;&lt;P&gt;in_layer = arcpy.ApplySymbologyFromLayer_management(in_layer,in_symbology_layer,update_symbology="MAINTAIN")[0]&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;in_layer = arcpy.ApplySymbologyFromLayer_management(str(in_layer),in_symbology_layer,update_symbology="MAINTAIN")[0]&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 16:17:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1273625#M67397</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2023-03-30T16:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of an existing layer through arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1273996#M67441</link>
      <description>&lt;P&gt;I just tried using string instead of layer in the ApplySymbologyFromLayer() function, and the results are the same. No errors returned, and the layer symbology does not change..&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 07:56:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1273996#M67441</guid>
      <dc:creator>TorbjørnDalløkken2</dc:creator>
      <dc:date>2023-03-31T07:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of an existing layer through arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1276056#M67650</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/314803"&gt;@TorbjørnDalløkken2&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;Have you taken a look at the arcpy.mp module.&amp;nbsp; We support a limited number of renderers currently but UniqueValue is one of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are a couple of starting points&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/symbology-class.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/symbology-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/uniquevaluerenderer-class.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/uniquevaluerenderer-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And then Python CIM Access could be used to modify properties not exposed to the API.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeff - Layout and arcpy.mp teams&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 02:42:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1276056#M67650</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2023-04-06T02:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of an existing layer through arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1337873#M73991</link>
      <description>&lt;P&gt;This code worked for me..&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;p2 = arcpy.mp.ArcGISProject(aprfilenew)&lt;BR /&gt;maps = p2.listMaps()&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;map &lt;SPAN&gt;in &lt;/SPAN&gt;maps:&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(&lt;SPAN&gt;'--------------------------------------------------------------'&lt;/SPAN&gt;)&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(map.name)&lt;BR /&gt;    &lt;SPAN&gt;print &lt;/SPAN&gt;(&lt;SPAN&gt;'--------------------------------------------------------------'&lt;/SPAN&gt;)&lt;BR /&gt;    layers = map.listLayers()&lt;BR /&gt;    &lt;SPAN&gt;for &lt;/SPAN&gt;layer &lt;SPAN&gt;in &lt;/SPAN&gt;layers:&lt;BR /&gt;        &lt;SPAN&gt;if &lt;/SPAN&gt;layer.supports(&lt;SPAN&gt;'NAME'&lt;/SPAN&gt;) &lt;SPAN&gt;and &lt;/SPAN&gt;layer.supports(&lt;SPAN&gt;'LONGNAME'&lt;/SPAN&gt;) \&lt;BR /&gt;                    &lt;SPAN&gt;and &lt;/SPAN&gt;layer.supports(&lt;SPAN&gt;'DATASOURCE'&lt;/SPAN&gt;):&lt;BR /&gt;            &lt;SPAN&gt;print &lt;/SPAN&gt;(layer.longName + &lt;SPAN&gt;' ---&amp;gt; ' &lt;/SPAN&gt;+ layer.dataSource)&lt;BR /&gt;        &lt;SPAN&gt;print&lt;/SPAN&gt;(layer.longName)&lt;BR /&gt;&lt;BR /&gt;        newfeaturelayer = layer.longName&lt;BR /&gt;        arcpy.MakeFeatureLayer_management(layer&lt;SPAN&gt;, &lt;/SPAN&gt;newfeaturelayer)&lt;BR /&gt;        newLayerout = newfeaturelayer + &lt;SPAN&gt;"-az"  &lt;/SPAN&gt;&lt;SPAN&gt;# ## rename this as needed....&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;        arcpy.ApplySymbologyFromLayer_management(newfeaturelayer&lt;SPAN&gt;, &lt;/SPAN&gt;layer)&lt;BR /&gt;&lt;BR /&gt;        arcpy.SaveToLayerFile_management(newfeaturelayer&lt;SPAN&gt;, &lt;/SPAN&gt;path + newLayerout + &lt;SPAN&gt;'.lyrx'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"ABSOLUTE"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 Oct 2023 18:13:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1337873#M73991</guid>
      <dc:creator>SGTomlins</dc:creator>
      <dc:date>2023-10-13T18:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of an existing layer through arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1399856#M80833</link>
      <description>&lt;P&gt;Why do we have to perform all this coding when simply importing a saved layer file (lyr or lyrx) should work programmatically? In other words, what's the point of having the "Apply Symbology From Layer" function when it's not doing what it's supposed to be doing?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 20:59:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1399856#M80833</guid>
      <dc:creator>JohnGaiot</dc:creator>
      <dc:date>2024-03-22T20:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of an existing layer through arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1606708#M95037</link>
      <description>&lt;P&gt;Still hasn't been fixed.&amp;nbsp; I have 300 layers for which I have to apply a predefined symbology and I'm having the same problems.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2025 21:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1606708#M95037</guid>
      <dc:creator>Jeff_Lee</dc:creator>
      <dc:date>2025-04-16T21:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change symbology of an existing layer through arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1673602#M100870</link>
      <description>&lt;P&gt;I'm having the same issue. I have a symbology that I need to apply to 100 maps. After making one map manually with the desired symbology, I exported the symbology to a .lyrx file. I wrote a python script to walk through my folder containing all 99 of my maps and I applied the python tool "arcpy.management.ApplySymbologyFromLayer()"&amp;nbsp; to apply my .lyrx file to every appropriate layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran the code with no errors and when I went back to open my maps, none of the symbology changed.&lt;/P&gt;&lt;P&gt;While there may be a new trick or modification to fix this problem, my code "should" work because the python code I am applying matches the python code used in the ArcPro guidelines. Also, thank you to everyone providing alternative code in the comments. Trying that now.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Dec 2025 14:57:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-symbology-of-an-existing-layer-through/m-p/1673602#M100870</guid>
      <dc:creator>KellyJanus1</dc:creator>
      <dc:date>2025-12-17T14:57:35Z</dc:date>
    </item>
  </channel>
</rss>

