<?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: How to check the ListLayers(Map) is Empty or not in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147474#M11464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
layerlist = arcpy.mapping.ListLayers(...)
if layerlist:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do_something()
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handle_empty_layer_list()
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 08:01:04 GMT</pubDate>
    <dc:creator>NiklasNorrthon</dc:creator>
    <dc:date>2021-12-11T08:01:04Z</dc:date>
    <item>
      <title>How to check the ListLayers(Map) is Empty or not</title>
      <link>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147473#M11463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am looking for a method to find out if the ListLayers id empty or not using arcpy.mapping&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I appreciate if you ca give me an idea bout this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Mar 2011 22:23:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147473#M11463</guid>
      <dc:creator>BruceGreen</dc:creator>
      <dc:date>2011-03-07T22:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to check the ListLayers(Map) is Empty or not</title>
      <link>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147474#M11464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
layerlist = arcpy.mapping.ListLayers(...)
if layerlist:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do_something()
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handle_empty_layer_list()
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:01:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147474#M11464</guid>
      <dc:creator>NiklasNorrthon</dc:creator>
      <dc:date>2021-12-11T08:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to check the ListLayers(Map) is Empty or not</title>
      <link>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147475#M11465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Niklas&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I will check it and reply you the result&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 14:15:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147475#M11465</guid>
      <dc:creator>BruceGreen</dc:creator>
      <dc:date>2011-03-08T14:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to check the ListLayers(Map) is Empty or not</title>
      <link>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147476#M11466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know this is an old thread, but a working snip was never posted, so here you go!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TurnOffLayer.py&lt;/P&gt;&lt;P&gt;_________________&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;fileName=arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;mxd = arcpy.mapping.MapDocument("CURRENT")&lt;BR /&gt;lyr=arcpy.mapping.ListLayers(mxd, fileName)&lt;/P&gt;&lt;P&gt;if lyr:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr[0].visible==True: &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr[0].visible=False&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&lt;/P&gt;&lt;P&gt;sys.argv[2]=True&lt;BR /&gt;arcpy.SetParameter(1,"True")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2018 21:40:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-check-the-listlayers-map-is-empty-or-not/m-p/147476#M11466</guid>
      <dc:creator>RichardDaniels</dc:creator>
      <dc:date>2018-05-03T21:40:26Z</dc:date>
    </item>
  </channel>
</rss>

