<?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 Changing Layer Symbology with Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/changing-layer-symbology-with-python/m-p/194898#M14958</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having problems changing layer symbology in ArcGIS Pro using Python. I have a feature class where the symbology has changed because the data in the fields used to define the symbolgy has changed. I'm trying to use Python to create a list of layers that need to be changed and then updating the symbology using the ApplySymbologyFromLayer function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However; in Pro I am unable to make any changes using an IDE. If I try to use the Python window in Pro then it only updates the first target layer; but it updates that first layer for as many times as the number of items in the layer list. The only way I can update the symbology correctly is to use the Python window in Pro and rename all the target layers so they have different names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conversely, in Desktop I am able to create a list of layers and use the&amp;nbsp;&lt;SPAN&gt;ApplySymbologyFromLayer with no problems; whether I use an IDE or the Python window.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does Pro treat layer objects differently for some reason? I've noticed that using the geoprocessing method for importing symbology layers with the same name have a number appended to the end.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I make changing the layer symbology in Pro with Python work?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Nov 2019 16:19:42 GMT</pubDate>
    <dc:creator>MarkBinder</dc:creator>
    <dc:date>2019-11-13T16:19:42Z</dc:date>
    <item>
      <title>Changing Layer Symbology with Python</title>
      <link>https://community.esri.com/t5/python-questions/changing-layer-symbology-with-python/m-p/194898#M14958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having problems changing layer symbology in ArcGIS Pro using Python. I have a feature class where the symbology has changed because the data in the fields used to define the symbolgy has changed. I'm trying to use Python to create a list of layers that need to be changed and then updating the symbology using the ApplySymbologyFromLayer function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However; in Pro I am unable to make any changes using an IDE. If I try to use the Python window in Pro then it only updates the first target layer; but it updates that first layer for as many times as the number of items in the layer list. The only way I can update the symbology correctly is to use the Python window in Pro and rename all the target layers so they have different names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conversely, in Desktop I am able to create a list of layers and use the&amp;nbsp;&lt;SPAN&gt;ApplySymbologyFromLayer with no problems; whether I use an IDE or the Python window.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does Pro treat layer objects differently for some reason? I've noticed that using the geoprocessing method for importing symbology layers with the same name have a number appended to the end.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I make changing the layer symbology in Pro with Python work?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Nov 2019 16:19:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/changing-layer-symbology-with-python/m-p/194898#M14958</guid>
      <dc:creator>MarkBinder</dc:creator>
      <dc:date>2019-11-13T16:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Layer Symbology with Python</title>
      <link>https://community.esri.com/t5/python-questions/changing-layer-symbology-with-python/m-p/194899#M14959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is currently logged as a Bug I think (&lt;SPAN style="font: 300 15px/2.32rem 'Avenir Next W01','Avenir Next W00','Avenir Next',Avenir,'Helvetica Neue',Helvetica,Arial,sans-serif; text-align: left; color: #007ac2; text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;Bug BUG-000108497&lt;/SPAN&gt;,&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #595959; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next',Avenir,'Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 0.93rem; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.55rem; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Running the Apply Layer Symbology tool as a script in the Python window does not update the symbology in the map. ) The workaround (closing and reopening the project) does not seem to work as far as I can tell.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2020 11:45:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/changing-layer-symbology-with-python/m-p/194899#M14959</guid>
      <dc:creator>LeandraGordon</dc:creator>
      <dc:date>2020-06-27T11:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Layer Symbology with Python</title>
      <link>https://community.esri.com/t5/python-questions/changing-layer-symbology-with-python/m-p/194900#M14960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/111992"&gt;Mark Binder&lt;/A&gt;‌ - I finally worked out how to do it a Python Toolbox, here's an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Init:&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;# Spatial Data Layer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;param0 = arcpy.Parameter(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; displayName="Spatial Data Layer (SPATIALDATA_LYR)",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name ="SPATIALDATA_LYR",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datatype="GPFeatureLayer",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameterType="Derived",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; direction="Output")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; param0.value = "SPATIALDATA_LYR"&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # SMG (line) Layer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; param1 = arcpy.Parameter(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; displayName="SMG_LINE_LYR",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name ="SMG_LINE_LYR",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datatype="GPFeatureLayer",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameterType="Derived",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; direction="Output")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; param1.value = "SMG_LINE_LYR"&lt;/DIV&gt;&lt;DIV&gt;……...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; def execute(self, parameters, messages):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; """The source code of the tool."""&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput=True&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Script arguments&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPATIALDATA_LYR=parameters[0].valueAsText&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SMG_LINE_LYR= parameters[1].valueAsText&lt;/DIV&gt;&lt;DIV&gt;…..&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #LYRX File vars&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPATIALDATA_LYRX =os.path.join(SEVENA_LYRX_DIR, "SPATIALDATA.lyrx")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SMG_LYRX =os.path.join(SEVENA_LYRX_DIR, "SMG_NAME.lyrx")&lt;/DIV&gt;&lt;DIV&gt;…...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.ApplySymbologyFromLayer(SPATIALDATA_LYR, SPATIALDATA_LYRX)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(0, SPATIALDATA_LYR) &lt;A href="https://community.esri.com/t5/tag/&amp;lt;--------------THIS/tg-p"&gt;#&amp;lt;--------------THIS&lt;/A&gt;!!!&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # SMG Line - getParameterInfo incl value, symb as os.path.join&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.ApplySymbologyFromLayer(SMG_LINE_LYR, SMG_LYRX, None, "UPDATE")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameterAsText(1, SMG_LINE_LYR)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I have no idea why setting the parameter again makes it work, but it works.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2020 07:36:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/changing-layer-symbology-with-python/m-p/194900#M14960</guid>
      <dc:creator>LeandraGordon</dc:creator>
      <dc:date>2020-08-17T07:36:42Z</dc:date>
    </item>
  </channel>
</rss>

