<?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 ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1600724#M94465</link>
    <description>&lt;P&gt;The following code works beautifully the first time the function is called. The &lt;EM&gt;&lt;STRONG&gt;second&lt;/STRONG&gt; &lt;/EM&gt;time the function is called, the new second parameter value, Forest_TmbrVol_Source, is ignored while the new first parameter value, Project_TmbrVol_Path, is correctly used.&lt;/P&gt;&lt;P&gt;The result is that in both function calls, the input layer is symbolized by the same Forest_SlopePrc_Source symbology, which in the second call, results in Timber Volume being symbolized with Slope Percentage symbology rather than Timber Volume symbology as coded.&lt;/P&gt;&lt;P&gt;This error is not a result of duplicate names or incorrectly called vars. I coded messages to return the values of what was passed and processed and there are no errors there. The problem appears to be the persistence of the same initial variable used in the ApplySymbologyFromLayer tool for the reference symbology raster.&lt;/P&gt;&lt;P&gt;Reversing the order of the two calls, does not change this behavior. The mismatch in the 2nd call continues, but reversed., such that the input layer is incorrectly symbolized by Forest_TimbVol_Source rather than Forest_SlopePrc_Source symbology as coded.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillMasters1_1-1743475771471.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129123i8FB08879BFBA3CC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JillMasters1_1-1743475771471.png" alt="JillMasters1_1-1743475771471.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Image content:&lt;/P&gt;&lt;DIV&gt;#function&lt;/DIV&gt;&lt;DIV&gt;def apply_symbology(target_raster, symb_raster):&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#apply symbology&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;target = current_map.addDataFromPath(target_raster)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;symbLayer = current_map.addDataFromPath(symb_raster)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;symb=symbLayer.listLayers()[2]&amp;nbsp; &amp;nbsp;#returns Raster Image&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;outlayer = arcpy.management.ApplySymbologyFromLayer(target, symb)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;current_map.addLayer(outlayer[0])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#var assignments&lt;/DIV&gt;&lt;DIV&gt;proj_folder=r'C:\Project\LayerFile\Clipped'&lt;/DIV&gt;&lt;DIV&gt;Forest_SlopePrc_Source = r'C:\Project\LayerFile\ImageryAndClassifiedImagery\LiDAR_1m_BareEarth_SlopePct_Color.lyr'&lt;/DIV&gt;&lt;DIV&gt;Forest_TmbrVol_Source = r'C:\Project\LayerFile\ImageryAndClassifiedImagery\LiDAR_30m_modeled_Volume_boardft_gt_9in_per_acre.lyr'&lt;/DIV&gt;&lt;DIV&gt;Project_SlopePrc_Path = proj_folder + '\\Project_SlopePrc'&lt;/DIV&gt;&lt;DIV&gt;Project_TmbrVol_Path = proj_folder + '\\Project_TmbrVol'&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#function call&lt;/DIV&gt;&lt;DIV&gt;apply_symbology(Project_SlopePrc_Path, Forest_SlopePrc_Source)&lt;/DIV&gt;&lt;DIV&gt;apply_symbology(Project_TmbrVol_Path, Forest_TmbrVol_Source)&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Apr 2025 02:50:18 GMT</pubDate>
    <dc:creator>JillMasters1</dc:creator>
    <dc:date>2025-04-01T02:50:18Z</dc:date>
    <item>
      <title>ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1600724#M94465</link>
      <description>&lt;P&gt;The following code works beautifully the first time the function is called. The &lt;EM&gt;&lt;STRONG&gt;second&lt;/STRONG&gt; &lt;/EM&gt;time the function is called, the new second parameter value, Forest_TmbrVol_Source, is ignored while the new first parameter value, Project_TmbrVol_Path, is correctly used.&lt;/P&gt;&lt;P&gt;The result is that in both function calls, the input layer is symbolized by the same Forest_SlopePrc_Source symbology, which in the second call, results in Timber Volume being symbolized with Slope Percentage symbology rather than Timber Volume symbology as coded.&lt;/P&gt;&lt;P&gt;This error is not a result of duplicate names or incorrectly called vars. I coded messages to return the values of what was passed and processed and there are no errors there. The problem appears to be the persistence of the same initial variable used in the ApplySymbologyFromLayer tool for the reference symbology raster.&lt;/P&gt;&lt;P&gt;Reversing the order of the two calls, does not change this behavior. The mismatch in the 2nd call continues, but reversed., such that the input layer is incorrectly symbolized by Forest_TimbVol_Source rather than Forest_SlopePrc_Source symbology as coded.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillMasters1_1-1743475771471.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/129123i8FB08879BFBA3CC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JillMasters1_1-1743475771471.png" alt="JillMasters1_1-1743475771471.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Image content:&lt;/P&gt;&lt;DIV&gt;#function&lt;/DIV&gt;&lt;DIV&gt;def apply_symbology(target_raster, symb_raster):&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#apply symbology&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;target = current_map.addDataFromPath(target_raster)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;symbLayer = current_map.addDataFromPath(symb_raster)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;symb=symbLayer.listLayers()[2]&amp;nbsp; &amp;nbsp;#returns Raster Image&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;outlayer = arcpy.management.ApplySymbologyFromLayer(target, symb)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;current_map.addLayer(outlayer[0])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#var assignments&lt;/DIV&gt;&lt;DIV&gt;proj_folder=r'C:\Project\LayerFile\Clipped'&lt;/DIV&gt;&lt;DIV&gt;Forest_SlopePrc_Source = r'C:\Project\LayerFile\ImageryAndClassifiedImagery\LiDAR_1m_BareEarth_SlopePct_Color.lyr'&lt;/DIV&gt;&lt;DIV&gt;Forest_TmbrVol_Source = r'C:\Project\LayerFile\ImageryAndClassifiedImagery\LiDAR_30m_modeled_Volume_boardft_gt_9in_per_acre.lyr'&lt;/DIV&gt;&lt;DIV&gt;Project_SlopePrc_Path = proj_folder + '\\Project_SlopePrc'&lt;/DIV&gt;&lt;DIV&gt;Project_TmbrVol_Path = proj_folder + '\\Project_TmbrVol'&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#function call&lt;/DIV&gt;&lt;DIV&gt;apply_symbology(Project_SlopePrc_Path, Forest_SlopePrc_Source)&lt;/DIV&gt;&lt;DIV&gt;apply_symbology(Project_TmbrVol_Path, Forest_TmbrVol_Source)&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 02:50:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1600724#M94465</guid>
      <dc:creator>JillMasters1</dc:creator>
      <dc:date>2025-04-01T02:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1600738#M94468</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/apply-symbology-from-layer.htm" target="_blank"&gt;Apply Symbology From Layer (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The "optional" parameter describes the situations where symbology won't be updated.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you confirm that this doesn't apply?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Update_symbology&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;(Optional)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Specifies whether symbology ranges will be updated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;DEFAULT—Symbology ranges will be updated, except in the following situations:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;When the input layer is empty&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;When the symbology layer uses class breaks (for example, graduated colors or graduated symbols) and the classification method is manual or defined interval&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;When the symbology layer uses unique values and the Show all other values option is checked&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;UPDATE—Symbology ranges will be updated.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;MAINTAIN—Symbology ranges will not be updated; they will be maintained.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;As for code formatting to facilitate reading and line number referencing, have a look at...&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 01:05:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1600738#M94468</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-03-31T01:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1600913#M94481</link>
      <description>&lt;P&gt;The code works without issue if I run the code for only one call.&lt;/P&gt;&lt;P&gt;The problem occurs when I run the code for multiple calls in a row.&lt;/P&gt;&lt;P&gt;def applysymbology(inlayer, outlayer):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;some code&lt;/P&gt;&lt;P&gt;applysymbology(xy,yy)&lt;/P&gt;&lt;P&gt;applysymbology(ss,tt)&lt;/P&gt;&lt;P&gt;The first call works without issue.&lt;/P&gt;&lt;P&gt;The second call applies symbology from yy instead of tt!&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 16:00:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1600913#M94481</guid>
      <dc:creator>JillMasters1</dc:creator>
      <dc:date>2025-03-31T16:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601026#M94486</link>
      <description>&lt;P&gt;What's tempSymbRaster? it seems to be defined outside of your function.&amp;nbsp; I think that's the culprit.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 18:47:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601026#M94486</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2025-03-31T18:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601029#M94488</link>
      <description>&lt;P&gt;something is persisting then between runs.&amp;nbsp; At this point all I can suggest is adding a Save Project between the two runs to see if it "clears".&lt;/P&gt;&lt;P&gt;If that doesn't work, then Tech Support is your best bet&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 18:50:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601029#M94488</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-03-31T18:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601168#M94503</link>
      <description>&lt;P&gt;As soon as I can get the VDI to run (it's very temperamental today), I will try adding a Save Project.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 02:42:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601168#M94503</guid>
      <dc:creator>JillMasters1</dc:creator>
      <dc:date>2025-04-01T02:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601170#M94504</link>
      <description>&lt;P&gt;Miscopy of actual code on my part. I corrected the mis-identified var name in my post. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 02:44:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601170#M94504</guid>
      <dc:creator>JillMasters1</dc:creator>
      <dc:date>2025-04-01T02:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro ArcPy defined function not resetting symbology reference parameter in subsequent function calls</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601186#M94506</link>
      <description>&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;If anyone knows of a better workaround. Please advise!!&lt;/P&gt;&lt;P&gt;I could not find a workaround, other than to separate my code into 2 files, and apply the symbology manually in-between. The first file contains the code up to apply symbology and the second file containing the code after I manually apply symbology.&amp;nbsp; Not happy. Hope ESRI will fix the tool soon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not the solution!&lt;BR /&gt;&lt;STRIKE&gt;My workaround was to simply delete the parameter variables at the end of the code and then there was no issue with persistence.&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;def applysymbology(in, out):&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;some code&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;del in&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;del out&lt;/STRIKE&gt;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;applysymbology(xy,yy)&lt;/STRIKE&gt;&lt;BR /&gt;&lt;STRIKE&gt;applysymbology(ss,tt)&lt;/STRIKE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 15:11:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpro-arcpy-defined-function-not-resetting/m-p/1601186#M94506</guid>
      <dc:creator>JillMasters1</dc:creator>
      <dc:date>2025-04-01T15:11:45Z</dc:date>
    </item>
  </channel>
</rss>

