<?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: Apply Changes to Mapview in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1026098#M59924</link>
    <description>&lt;P&gt;Unfortunately they took away the refreshActiveView option in pro.&amp;nbsp; If possible use CURRENT for the map.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/migratingfrom10xarcpymapping.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/migratingfrom10xarcpymapping.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;The application always refreshes when using CURRENT&lt;/H2&gt;&lt;P&gt;When you use the CURRENT keyword in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="uicontrol"&gt;Python&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;window with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="ph"&gt;ArcGIS Desktop&lt;/SPAN&gt;, you sometimes had to call&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="usertext"&gt;refreshActiveView&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to force a screen refresh. This is no longer the case with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="ph"&gt;ArcGIS Pro&lt;/SPAN&gt;. All&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="usertext"&gt;arcpy.mp&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;API changes directly update&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="ph"&gt;ArcGIS Pro&lt;/SPAN&gt;."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Feb 2021 22:11:01 GMT</pubDate>
    <dc:creator>MatthewDriscoll</dc:creator>
    <dc:date>2021-02-11T22:11:01Z</dc:date>
    <item>
      <title>Apply Changes to Mapview</title>
      <link>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1026085#M59922</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have the following procedure which turns layers on or off on a mapview. But I find that the changes only apply if I save the project but I find saving the project adds alot of time onto the execution of the script. Is there something different I can do, possibly some way that will just update the mapview where the layers have been turned on/off?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def SetLayers(prj, mapName, lyrs, status):
    aprx = arcpy.mp.ArcGISProject(prj)
    m = aprx.listMaps(mapName)[0]
    
    for lyr in m.listLayers():
        if lyr.name.upper() in lyrs:
            if status == 'on':
                lyr.visible = True
            else:
                lyr.visible = False
    aprx.save()
    del aprx&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 21:23:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1026085#M59922</guid>
      <dc:creator>ChrisHolmes</dc:creator>
      <dc:date>2021-02-11T21:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Changes to Mapview</title>
      <link>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1026098#M59924</link>
      <description>&lt;P&gt;Unfortunately they took away the refreshActiveView option in pro.&amp;nbsp; If possible use CURRENT for the map.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/migratingfrom10xarcpymapping.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/migratingfrom10xarcpymapping.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;The application always refreshes when using CURRENT&lt;/H2&gt;&lt;P&gt;When you use the CURRENT keyword in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="uicontrol"&gt;Python&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;window with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="ph"&gt;ArcGIS Desktop&lt;/SPAN&gt;, you sometimes had to call&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="usertext"&gt;refreshActiveView&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to force a screen refresh. This is no longer the case with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="ph"&gt;ArcGIS Pro&lt;/SPAN&gt;. All&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="usertext"&gt;arcpy.mp&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;API changes directly update&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="ph"&gt;ArcGIS Pro&lt;/SPAN&gt;."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 22:11:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1026098#M59924</guid>
      <dc:creator>MatthewDriscoll</dc:creator>
      <dc:date>2021-02-11T22:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Changes to Mapview</title>
      <link>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1027213#M59986</link>
      <description>&lt;P&gt;That is completely correct and actually I remember reading this link in the past. SetLayers is used to turn layers on/off before running a procedure to create images. As a test I ran it how it currently works (using a passed in path to a project), I set it to create 4 images but killed the script after 12 minutes and having created 2 of the images.&lt;/P&gt;&lt;P&gt;I then changed my code to use 'CURRENT', reran the test and it created all 4 images in 35 seconds!&lt;/P&gt;&lt;P&gt;Thanks for the reminder. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 17:15:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1027213#M59986</guid>
      <dc:creator>ChrisHolmes</dc:creator>
      <dc:date>2021-02-16T17:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Changes to Mapview</title>
      <link>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1027220#M59987</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChrisHolmes_0-1613495899099.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6139i3EFB1B28F37A5F69/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChrisHolmes_0-1613495899099.png" alt="ChrisHolmes_0-1613495899099.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm assuming though if there is a need to save the project at the end of a script that works with 'CURRENT', you will still need to do a .save()?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 17:19:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/apply-changes-to-mapview/m-p/1027220#M59987</guid>
      <dc:creator>ChrisHolmes</dc:creator>
      <dc:date>2021-02-16T17:19:17Z</dc:date>
    </item>
  </channel>
</rss>

