<?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: removeLayer require some kind of refresh? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109923#M62749</link>
    <description>&lt;P&gt;since you are running it from a tool, try&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;activeMap&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;see the 4th paragraph in&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank" rel="noopener"&gt;ArcGISProject—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;More importantly, since you are using a tool, this reference provides some guidance on whether to reference the project on disk or if the project is open, to use CURRENT&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/guidelines-for-arcpy-mapping.htm" target="_blank" rel="noopener"&gt;Guidelines for arcpy.mp—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;that may illuminate some differences, since changes to projects aren't persisted until projects are saved or saved to a copy&lt;/P&gt;</description>
    <pubDate>Thu, 21 Oct 2021 19:57:54 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-10-21T19:57:54Z</dc:date>
    <item>
      <title>removeLayer require some kind of refresh?</title>
      <link>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109820#M62739</link>
      <description>&lt;P&gt;ArcGIS Pro 2.8.3&lt;/P&gt;&lt;P&gt;The following lines seem to "technically" remove a layer from my map and save the project, but I still see the layer in the contents of my map until I close the project and re-open it.&amp;nbsp; Do I need to refresh the contents somehow?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;aprxMap&lt;/SPAN&gt;&lt;SPAN&gt;.removeLayer(&lt;/SPAN&gt;&lt;SPAN&gt;layer&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;aprx&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;save&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Oct 2021 16:48:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109820#M62739</guid>
      <dc:creator>RandallBrown</dc:creator>
      <dc:date>2021-10-21T16:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: removeLayer require some kind of refresh?</title>
      <link>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109841#M62742</link>
      <description>&lt;P&gt;python window? python notebook? separate python IDE? tool in a toolbox?&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;EM&gt;There are many&amp;nbsp;is&amp;nbsp;properties that allow you to determine if a layer fits into a general category:&amp;nbsp;is3DLayer,&amp;nbsp;isFeatureLayer,&amp;nbsp;isGroupLayer,&amp;nbsp;isRasterLayer, and&amp;nbsp;isServiceLayer&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;and remove is from layer files or the map class&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layerfile-class.htm" target="_blank" rel="noopener"&gt;LayerFile—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/map-class.htm" target="_blank" rel="noopener"&gt;Map—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;there is no refresh in arcgis pro's python&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 17:14:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109841#M62742</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-10-21T17:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: removeLayer require some kind of refresh?</title>
      <link>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109874#M62744</link>
      <description>&lt;P&gt;This is part of a script tool in a toolbox.&amp;nbsp; &amp;nbsp;The method I am using is removeLayer on the map class.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 18:35:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109874#M62744</guid>
      <dc:creator>RandallBrown</dc:creator>
      <dc:date>2021-10-21T18:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: removeLayer require some kind of refresh?</title>
      <link>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109877#M62745</link>
      <description>&lt;P&gt;Here is a bit more of the code:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;import sys, string, os, arcpy, time&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;from arcpy import env, mp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aprx = mp.ArcGISProject(aprxPath)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;aprxMap = aprx.listMaps()[0]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;for layer in aprxMap.listLayers():&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; if layer.name == 'myLayer':&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; aprxMap.removeLayer(layer)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;aprx.save()&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 18:43:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109877#M62745</guid>
      <dc:creator>RandallBrown</dc:creator>
      <dc:date>2021-10-21T18:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: removeLayer require some kind of refresh?</title>
      <link>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109923#M62749</link>
      <description>&lt;P&gt;since you are running it from a tool, try&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;activeMap&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;see the 4th paragraph in&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank" rel="noopener"&gt;ArcGISProject—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;More importantly, since you are using a tool, this reference provides some guidance on whether to reference the project on disk or if the project is open, to use CURRENT&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/guidelines-for-arcpy-mapping.htm" target="_blank" rel="noopener"&gt;Guidelines for arcpy.mp—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;that may illuminate some differences, since changes to projects aren't persisted until projects are saved or saved to a copy&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 19:57:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1109923#M62749</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-10-21T19:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: removeLayer require some kind of refresh?</title>
      <link>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1110001#M62756</link>
      <description>&lt;P&gt;It just started working for me the way I had it written.&amp;nbsp; Could be it was only not updating the layers when I was debugging in VSCode, but I could swear I had tested it from within AGPro as well.&amp;nbsp; Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 21:47:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1110001#M62756</guid>
      <dc:creator>RandallBrown</dc:creator>
      <dc:date>2021-10-21T21:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: removeLayer require some kind of refresh?</title>
      <link>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1110006#M62758</link>
      <description>&lt;P&gt;it won't do anything in a separate python ide, it either has to be the python window, notebook or a toolbox script&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 22:02:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removelayer-require-some-kind-of-refresh/m-p/1110006#M62758</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-10-21T22:02:37Z</dc:date>
    </item>
  </channel>
</rss>

