<?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: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482152#M37693</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK, so you must be running in the python window from within ArcMap if it is finding current layers in the TOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have never had a reason to do this, so all my scripting is done stand alone, so not sure if this will make a difference, but you might try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

mxDoc = arcpy.mapping.MapDocument("CURRENT")

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and see if that makes a differnce.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also, this is Arcpy, so you never know for sure if it is working correctly.&amp;nbsp; If you can't get it to work, you might try arcpy.mapping.UpdateLayer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:16:59 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2021-12-11T21:16:59Z</dc:date>
    <item>
      <title>ApplySymbologyFromLayer_management creates copy of a layer rather than updating it</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482149#M37690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm very new to ArcPy, and have encountered a roadblock when trying to update a layer's symbology using ApplySymbologyFromLayer_management. It works, but it creates a copy of the target layer rather than updating it in place. In order to clean out the duplicates, I attempted to apply the RemoveLayer function to the original layer (as seen on the second to last line), but this did not seem to remove it from the TOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import analysis, env&amp;nbsp; workspace = arcpy.env.workspace = r"C:/temp"&amp;nbsp; arcpy.env.overwriteOutput = True&amp;nbsp; mxDoc = arcpy.mapping.MapDocument(r"X:/GisResources/Mxd Map Templates/HighUnemploymentCensusTracts_Template.mxd")&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxDoc, "Detail Map") [0]&amp;nbsp; co_layer = arcpy.mapping.ListLayers(mxDoc,"",df) [0]&amp;nbsp; co_name = "NAME"&amp;nbsp; rows = arcpy.SearchCursor(co_layer)&amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; co = row.getValue(co_name) &amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = "NAME &amp;lt;&amp;gt; '%s'" % co &amp;nbsp;&amp;nbsp;&amp;nbsp; analysis.Select(co_layer, "Co_%s" % co, whereClause) &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ApplySymbologyFromLayer_management("Co_%s" % co, "Export_Output_21") &amp;nbsp;&amp;nbsp;&amp;nbsp; inputLayer = arcpy.mapping.Layer("Co_%s" % co) &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.RemoveLayer(df, inputLayer) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 20:05:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482149#M37690</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2013-06-12T20:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482150#M37691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Where is it finding the value of Export_Output_21 since this is the layer you are trying to apply the symbology from?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ApplySymbologyFromLayer_management (in_layer, in_symbology_layer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have not used ApplySymbologyFromLayer before, but arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, True) is working for me to update my symbology from a .lyr file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 21:00:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482150#M37691</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-06-12T21:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482151#M37692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Where is it finding the value of Export_Output_21 since this is the layer you are trying to apply the symbology from?&lt;BR /&gt;&lt;BR /&gt;ApplySymbologyFromLayer_management (in_layer, in_symbology_layer)&lt;BR /&gt;&lt;BR /&gt;I have not used ApplySymbologyFromLayer before, but arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, True) is working for me to update my symbology from a .lyr file.&lt;BR /&gt;&lt;BR /&gt;R_&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Export_Output_21 is a layer located within the Detail Map data frame. It seems to me that this function would be repeating this anomaly regardless of the details of the source layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be ok if it was happening if I could subsequently remove it from the TOC, but I can't even manage that! It doesn't help that the two layers (original and copy) both share the same name. If there is no explanation as to how to avoid the ApplySymbologyFromLayer from creating copies, does anyone know how to simply remove a layer from the TOC, because the following doesn't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.mapping.RemoveLayer(df, inputLayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:16:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482151#M37692</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2021-12-11T21:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482152#M37693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK, so you must be running in the python window from within ArcMap if it is finding current layers in the TOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have never had a reason to do this, so all my scripting is done stand alone, so not sure if this will make a difference, but you might try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

mxDoc = arcpy.mapping.MapDocument("CURRENT")

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and see if that makes a differnce.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also, this is Arcpy, so you never know for sure if it is working correctly.&amp;nbsp; If you can't get it to work, you might try arcpy.mapping.UpdateLayer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:16:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482152#M37693</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T21:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482153#M37694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I agree with rzufelt &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I usually use ApplySymbologyFromLayer to permanently set the symbols in a layer file on disc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So it is used when the lyr is brought into ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;UpdateLayer() is the best way to set the symbolization on an existing ArcMap layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You still reference an existing layer on disc or the TOC&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why, by the way, are you setting the symbolization and removing layers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from inside a search cursor? That makes no sense I can see.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to cycle through the various values in the NAME field as variables in a where clause&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you should use the cursor to build a list of the names.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;close the cursor, then cycle through the list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;rows = arcpy.SearchCursor(co_layer)
nameList = []
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; co = row.getValue(co_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; nameList.append(co)
del rows
for name in nameList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = ' "NAME" = \'%s\' ' % (name) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # ... and so on&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;reference the TOC layer object in ApplySymbologyFromLayer, not the name string&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;export_layer = arcpy.mapping.ListLayers(mxDoc,"Export_Output_21",df) [0]
arcpy.ApplySymbologyFromLayer_management("Co_%s" % co, export_layer)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:17:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482153#M37694</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2021-12-11T21:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482154#M37695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you both. Unfortunately, I won't be back in the office until Monday, so I will not be able to try out your suggestions until then. In the meantime, I can explain the purposes of this script. Text in bold indicates instructions that exist within the current script, as seen on the OP.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Iterate through features within IlCounties layer, and do the following for each feature:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Zoom to feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;Select all features not equal to feature within IlCounties&lt;BR /&gt;Export selection as new layer, add to Detail Map dataframe&lt;BR /&gt;Update new layer to incorporate symbology of Export_Output_21&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Add new layer to a second existing dataframe (named Locator Map)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Replace MXD title element to IlCounties feature name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Export as PDF&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm mostly just seeking help for the instructions in bold at the moment. I'll answer your questions and suggestions directly come Monday. Thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 17:47:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482154#M37695</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2013-06-13T17:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482155#M37696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, without the time to dive into this, this is the way I would approach it as I am doing something very similar and this method works for me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I'm not back until monday either. gotta love 4-10s.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Thank you both. Unfortunately, I won't be back in the office until Monday, so I will not be able to try out your suggestions until then. In the meantime, I can explain the purposes of this script. Text in bold indicates instructions that exist within the current script, as seen on the OP.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Iterate through features within IlCounties layer, and do the following for each feature:&lt;/STRONG&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;the da.walk will do this for you.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for dirpath, dirnames, filenames in arcpy.da.Walk(datatype="FeatureClass",type="All"):&amp;nbsp; ## would restrict this "All" to the feature/table type you are after&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rest of the code would go here since you want it for each feature in the FC....&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/SPAN&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Zoom to feature&lt;/STRONG&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="plain" name="code"&gt;cntyLayer = r'path\to\IlCounties" feature class&amp;nbsp;&amp;nbsp;&amp;nbsp; ###&amp;nbsp;&amp;nbsp;&amp;nbsp; would hard code this one since it is fixed, and we iterate through the others. df = arcpy.mapping.ListDataFrames(mxd, "Detail Map")[0] df2 = arcpy.mapping.ListDataFrames(mxd, "Locator Map")[0]&amp;nbsp;&amp;nbsp; #&amp;nbsp; Just as well set both df's while here lyr = arcpy.mapping.ListLayers(mxd, "IlCounties", df)[0] df.extent = lyr.getSelectedExtent(True)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Select all features not equal to feature within IlCounties&lt;/STRONG&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;Use SelectLayerByLocation with ARE_IDENTICAL_TO for overlap type and NEW_SELECTION for selection type.&lt;/SPAN&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;Use SelectLayerByLocation with SWITCH_SELECTION as selection type&lt;/SPAN&gt; ### These two will select features that are not equal to the other features&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Export selection as new layer, add to Detail Map dataframe&lt;/STRONG&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;Use CopyFeatures to export to new FGDB FC&lt;/SPAN&gt; # this will only copy/export the selected features&amp;nbsp; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;then AddLayer to add the new FC to the df.&lt;BR /&gt;&lt;BR /&gt;AddLayer(df,new_FC)&lt;BR /&gt;&lt;/SPAN&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Update new layer to incorporate symbology of Export_Output_21&lt;/STRONG&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;use UpdateLayer for this&lt;/SPAN&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Add new layer to a second existing dataframe (named Locator Map)&lt;/STRONG&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;add layer again AddLayer(df2,new_FC)&lt;/SPAN&gt; ## of course, you will have to update symobology again if needed.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Replace MXD title element to IlCounties feature name&lt;/STRONG&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;&lt;BR /&gt;legend = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "title")[0]&lt;BR /&gt;legend.text = filename&lt;/SPAN&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Export as PDF&lt;/STRONG&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;ExportToPDF (mxd, out_pdf,resolution=266) &lt;/SPAN&gt; &lt;BR /&gt; &lt;BR /&gt;I'm mostly just seeking help for the instructions in bold at the moment. I'll answer your questions and suggestions directly come Monday. Thank you!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now that I spelled it all out, easy to put together. should be something like this (you will need to fill in the blanks)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; cntyLayer = r'path\to\IlCounties' arcpy.MakeFeatureLayer_management(cntyLayer, "IlCounties_lyr")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dirpath, dirnames, filenames in arcpy.da.Walk(datatype="FeatureClass",type="All"):&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd, "Detail Map")[0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df2 = arcpy.mapping.ListDataFrames(mxd, "Locator Map")[0]&amp;nbsp;&amp;nbsp; #&amp;nbsp; Just as well set both df's while here &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = arcpy.mapping.ListLayers(mxd, "IlCounties", df)[0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df.extent = lyr.getSelectedExtent(True) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(filename, str(filename) + "_lyr")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectLayerByLocation(str(filename) + "_lyr", "ARE_IDENTICAL_TO", "IlCounties_lyr", #, NEW_SELECTION) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectLayerByLocation(str(filename) + "_lyr", "ARE_IDENTICAL_TO", "IlCounties_lyr", #, SWITCH_SELECTION) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CopyFeatures &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddLayer(df,new_FC) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdateLayer &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddLayer(df2,new_FC) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdateLayer &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; legend = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "title")[0] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; legend.text = filename &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExportToPDF (mxd, out_pdf,resolution=266)&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 21:13:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482155#M37696</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-06-13T21:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482156#M37697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thank you both. Unfortunately, I won't be back in the office until Monday, so I will not be able to try out your suggestions until then. In the meantime, I can explain the purposes of this script. Text in bold indicates instructions that exist within the current script, as seen on the OP.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Iterate through features within IlCounties layer, and do the following for each feature:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Zoom to feature&lt;BR /&gt;&lt;STRONG&gt;Select all features not equal to feature within IlCounties&lt;BR /&gt;Export selection as new layer, add to Detail Map dataframe&lt;BR /&gt;Update new layer to incorporate symbology of Export_Output_21&lt;/STRONG&gt;&lt;BR /&gt;Add new layer to a second existing dataframe (named Locator Map)&lt;BR /&gt;Replace MXD title element to IlCounties feature name&lt;BR /&gt;Export as PDF&lt;BR /&gt;&lt;BR /&gt;I'm mostly just seeking help for the instructions in bold at the moment. I'll answer your questions and suggestions directly come Monday. Thank you!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now that I read your post more carefully, I can make what you are "asking" for much simpler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How about this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

mxDoc = arcpy.mapping.MapDocument(r"X:/GisResources/Mxd Map Templates/HighUnemploymentCensusTracts_Template.mxd")
out_pdf = r"X:/GisResources/NewPDF.pdf")

ExportToPDF (mxDoc, out_pdf,resolution=266)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since "Iterate through features within IlCounties layer, and do the following for each feature"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and then "Select all features not equal to feature within IlCounties" if you are selecting for all features that are not equal to the same features you are comparing it to, you will always get zero results, so the rest of the code is not needed.&amp;nbsp; :cool:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still a little confused about what you are after I guess.&amp;nbsp; Also, what is the end result/purpose of this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My "similar" scripts, I just put a definition query on my layer(s) (same layer in both dataframes), then export to pdf.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Most the time, there would be no need to actually make a new layer, then add to the mxd unless your end result is actually to get the "new" FC created.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It almost sounds like you are just after a pdf with a map of all features minus one (without the current one).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case, I would just iterate through the OID's, set a definition query to OID &amp;lt;&amp;gt; iterOID (on a copy of the IlCounties layer in both df, with symbology applied)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;update thet text,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then dump to PDF&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This way, no need to create, add, update layers/and or symbology.&amp;nbsp; Symbology would be set, definition query would determine features displayed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OID &amp;lt;&amp;gt; iterOID as a definition query would display ALL features in IlCounties that do not match the currently "selected" feature.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I realize this post was initially about applying symbology, but, if you were to define your final objectives, there may be a much easier/faster way to accomplish it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:17:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482156#M37697</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T21:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: ApplySymbologyFromLayer_management creates copy of a layer rather than updating i</title>
      <link>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482157#M37698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you both rzufelt and mdenil for your suggestions, and apologies for not responding to your input yesterday (had to resolve something else). I was overwhelmed by the amount of advice I got! This is obviously a very supportive forum. The issue was resolved by rzufelt's suggestion to set the MXD to "current". &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I incorporated additional suggestions into my script on a piecemeal basis. The completed script can be seen below. By the way, rzufelt - you were wondering what my intentions were. I was intending to create a batch set of maps, one per county, describing areas of high unemployment. An example of the end result can be seen on the attachment. Luckily, the majority of the layout elements were not dynamic, with the exception of the subtitle, so customized changes did not have to be incorporated into the script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
from arcpy import analysis, env

workspace = arcpy.env.workspace = r"C:/temp"

env.overwriteOutput = True

mxDoc = arcpy.mapping.MapDocument("CURRENT")

df = arcpy.mapping.ListDataFrames(mxDoc, "Detail Map") [0]
df2 = arcpy.mapping.ListDataFrames(mxDoc, "Locator Map") [0]

co_layer = arcpy.mapping.ListLayers(mxDoc,"",df) [-1]

co_name = "NAME"

rows = arcpy.SearchCursor(co_layer)

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; co = row.getValue(co_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = "NAME &amp;lt;&amp;gt; '%s'" % co
&amp;nbsp;&amp;nbsp;&amp;nbsp; analysis.Select(co_layer, "Co_%s" % co, whereClause)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ApplySymbologyFromLayer_management("Co_%s" % co, "Export_Output_21")
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = arcpy.mapping.ListLayers(mxDoc, "", df)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.AddLayer(df2, lyr)
&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause2 = "NAME = '%s'" % co
&amp;nbsp;&amp;nbsp;&amp;nbsp; analysis.Select(co_layer, "Co_%s1" % co, whereClause2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = arcpy.mapping.ListLayers(mxDoc, "", df)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr1 = arcpy.mapping.ListLayers(mxDoc, "", df)[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr2 = arcpy.mapping.ListLayers(mxDoc, "", df2)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.extent = lyr.getSelectedExtent(True)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.RemoveLayer(df, lyr)
&amp;nbsp;&amp;nbsp;&amp;nbsp; title = arcpy.mapping.ListLayoutElements(mxDoc, "TEXT_ELEMENT", "*")[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; title.text = "%s County" % co
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxDoc, r"C:/temp/ProjectDataFrame%s.pdf" % co)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.RemoveLayer(df, lyr1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.RemoveLayer(df2, lyr2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView() &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:17:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/applysymbologyfromlayer-management-creates-copy-of/m-p/482157#M37698</guid>
      <dc:creator>BenjaminBauman</dc:creator>
      <dc:date>2021-12-11T21:17:07Z</dc:date>
    </item>
  </channel>
</rss>

