<?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: Python statement in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090677#M44663</link>
    <description>&lt;P&gt;And there goes the encouragement before the OP has even had a chance to read the links &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Aug 2021 02:16:18 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-08-20T02:16:18Z</dc:date>
    <item>
      <title>Python statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090565#M44647</link>
      <description>&lt;P&gt;I am learning Python right now for ArcGIS Pro. I'm new to object-oriented programming and need some help on understanding the statement order. I'm basically looking for a simple logic breakdown for order of statements. For example:&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If I'm reading this correctly, a direct translation is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;variable = object.function(parameters)&lt;/P&gt;&lt;P&gt;So, the current project is a parameter of the function ArcGISProject being called on the object arcpy.mp, which will be stored in the variable aprx?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What about this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;m = aprx.activeMap&lt;/P&gt;&lt;P&gt;activeMap is a method called on the now object aprx and stored in the variable m?&lt;/P&gt;&lt;P&gt;lyrList = m.listLayers()&lt;/P&gt;&lt;P&gt;the listLayer function is being called on the now object m and stored in the variable lyrList?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;for lyr in lyrList:&lt;BR /&gt;if lyr.isFeatureLayer:&lt;/P&gt;&lt;P&gt;a for-loop. It reads if a layers in the lyrList is a feature layer it gets stored as Boolean (T/F) in lyr?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 19:49:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090565#M44647</guid>
      <dc:creator>Eggnoggy</dc:creator>
      <dc:date>2021-08-19T19:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090587#M44649</link>
      <description>&lt;P&gt;Looks good&lt;/P&gt;&lt;P&gt;Light reading .... see the table of contents to the left on this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/main/arcgis-pro-arcpy-reference.htm" target="_blank"&gt;ArcGIS Pro Python reference—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 20:27:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090587#M44649</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-08-19T20:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090619#M44654</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I think that's a great understanding of how it works,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;except I will say that activeMap is actually a property of aprx (the ArcGISProject object), not a method().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You then have associated the Map object returned from that property to 'm' using&amp;nbsp; m = aprx.activeMap&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;see below link for the properties and methods of the ArcGISProject object/Class&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/arcgisproject-class.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 21:19:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090619#M44654</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-08-19T21:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090622#M44655</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;for lyr in lyrList:&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;if lyr.isFeatureLayer:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;a for-loop. It reads if a layers in the lyrList is a feature layer it gets stored as Boolean (T/F) in lyr?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Not really. You need to do something when an if statement evaluates to True or False....&lt;/P&gt;&lt;LI-CODE lang="python"&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.activeMap
lyrList = m.listLayers()
len(lyrList)
# returns 11
for i in lyrList:
    print(i)
Address Points 
Site Addresses
Subdivisions_MSD
MSD.SLCOMSD.AddressGridMSD
RoadCenterline All
CenterlinesMSD
MunicipalitiesMSD
MSD.SLCOMSD.ParcelsMSD
MSD.SLCOMSD.Zones
ZipcodesMSD
World Imagery
for i in lyrList:
    if i.isFeatureLayer:
        print('yay')

''' returns
yay
yay
yay
yay
yay
yay
yay
yay
yay
yay
'''&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Notice that while the length of my layer list = 11, when the if statement evaluates true, 'yay' is only printed 10 times. That's because the entry 'World Imagery' is not a feature layer.&amp;nbsp; Use an else to capture that:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for i in lyrList:
    if i.isFeatureLayer:
        print('yay')
    else:
        print(f'{i} is not a feature layer')
''' returns
yay
yay
yay
yay
yay
yay
yay
yay
yay
yay
World Imagery is not a feature layer
'''&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 21:23:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090622#M44655</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-08-19T21:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090677#M44663</link>
      <description>&lt;P&gt;And there goes the encouragement before the OP has even had a chance to read the links &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 02:16:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-statement/m-p/1090677#M44663</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-08-20T02:16:18Z</dc:date>
    </item>
  </channel>
</rss>

