<?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 Turn layers off w/ arcpy.mapping in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249922#M2649</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope y'all can help me get a handle on using arcpy.mapping.&amp;nbsp; When I run the 4 lines below in the python window, the layers in the project are displayed.&amp;nbsp; But if I uncomment "lyr.visible = False" , nothing happens - I had hoped the layer would be turned off.&amp;nbsp; How would I code turning the layer off?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Tripp&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for lyr in arcpy.mapping.ListLayers(mxd):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.visible = False&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Nov 2010 19:13:30 GMT</pubDate>
    <dc:creator>tripplowe</dc:creator>
    <dc:date>2010-11-11T19:13:30Z</dc:date>
    <item>
      <title>Turn layers off w/ arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249922#M2649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope y'all can help me get a handle on using arcpy.mapping.&amp;nbsp; When I run the 4 lines below in the python window, the layers in the project are displayed.&amp;nbsp; But if I uncomment "lyr.visible = False" , nothing happens - I had hoped the layer would be turned off.&amp;nbsp; How would I code turning the layer off?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Tripp&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for lyr in arcpy.mapping.ListLayers(mxd):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.visible = False&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 19:13:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249922#M2649</guid>
      <dc:creator>tripplowe</dc:creator>
      <dc:date>2010-11-11T19:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Turn layers off w/ arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249923#M2650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;arcpy.RefreshTOC()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 19:25:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249923#M2650</guid>
      <dc:creator>NiklasNorrthon</dc:creator>
      <dc:date>2010-11-11T19:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Turn layers off w/ arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249924#M2651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Perfect.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 19:55:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249924#M2651</guid>
      <dc:creator>tripplowe</dc:creator>
      <dc:date>2010-11-11T19:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Turn layers off w/ arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249925#M2652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Note:&amp;nbsp; the Refresh functions are only needed when referencing a map document using the "CURRENT" keyword.&amp;nbsp; Not all functions automatically refresh the current ArcMap application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When referencing a map document via a system path, the refresh functions are not required.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 12:23:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249925#M2652</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2010-11-12T12:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Turn layers off w/ arcpy.mapping</title>
      <link>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249926#M2653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3200"&gt;Jeff Barrette&lt;/A&gt; I ran this script from IDLE but it did not affect the visibility status of any layers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print "This script turns off the following layers:"&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy &lt;/P&gt;&lt;P&gt;except NameError:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy&lt;/P&gt;&lt;P&gt;mxd = arcpy.mapping.MapDocument(r"S:\EF1784\EF1784_Common\GIS\CODE SNIPPETS\remove bing\EF1784_050_000_GIS_0101.mxd")&lt;/P&gt;&lt;P&gt;for lyr in arcpy.mapping.ListLayers(mxd):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.visible = False&lt;/P&gt;&lt;P&gt;mxd.save&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the script in this thread from the Python window in ArcMap there are no issues. What am I doing wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Aug 2015 07:09:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/turn-layers-off-w-arcpy-mapping/m-p/249926#M2653</guid>
      <dc:creator>wilwaters</dc:creator>
      <dc:date>2015-08-16T07:09:03Z</dc:date>
    </item>
  </channel>
</rss>

