<?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 do I loop this to go through the every feature in the layer.  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132974#M10342</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only suggestion I would make is to create the feature layer outside of the loop.&amp;nbsp; I have found calling Make Feature Layer within a loop when only working with 1 data set tends to create both performance and memory management issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 May 2018 20:30:03 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2018-05-21T20:30:03Z</dc:date>
    <item>
      <title>How do I loop this to go through the every feature in the layer.</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132972#M10340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #004da8;"&gt;I'm trying to loop this to go through the every feature in&amp;nbsp;a&amp;nbsp;layer.&amp;nbsp;New to python and learning on the go here. This is the first time writing something so if see anything else let me know. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #004da8;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #004da8;"&gt;I&lt;SPAN style="color: #004da8;"&gt;&lt;SPAN style="color: #004da8;"&gt;mport&lt;/SPAN&gt; arcpy&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Local variables:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... GasUtilNode_Segment = &lt;SPAN style="color: #737300;"&gt;"GasUtilNode_Segment"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... GasUtilNode_Segment__3_ = GasUtilNode_Segment&lt;/P&gt;&lt;P&gt;... GasUtilNode_gControlFitting = &lt;SPAN style="color: #737300;"&gt;"GasUtilNode_gControlFitting"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... GasUtilNode_gControlFitting_ = &lt;SPAN style="color: #737300;"&gt;"\\\\zpstg07.mcip.usmc.mil\\roaming_profile\\home$\\geofi\\JJoffre\\Documents\\ArcGIS\\Default.gdb\\GasUtilNode_gControlFitting_"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Process: Select&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... arcpy.Select_analysis (&lt;SPAN style="color: #737300;"&gt;"GasUtilNode_gControlFitting"&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;r'P:\YU_Restricted\Yuma_Admin\Projects\FY18\WO18_100_199\18-190_Gas_Utilities_Update_(Plicka_Joffre)\Gas_Utilites.gdb\UTILITIES_GAS\Fitting2'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;"OBJECTID = 1"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Process: Make Feature Layer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... arcpy.MakeFeatureLayer_management( &lt;SPAN style="color: #737300;"&gt;"Fitting2"&lt;/SPAN&gt;,&lt;SPAN style="color: #737300;"&gt;r'P:\YU_Restricted\Yuma_Admin\Projects\FY18\WO18_100_199\18-190_Gas_Utilities_Update_(Plicka_Joffre)\Gas_Utilites.gdb\UTILITIES_GAS\Fitting2Layer'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;'#'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;'#'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;"OBJECTID OBJECTID VISIBLE NONE;gasUtilNodeIDPK gasUtilNodeIDPK VISIBLE NONE;gasNodeType gasNodeType VISIBLE NONE;mediaID mediaID VISIBLE NONE;operationalStatus operationalStatus VISIBLE NONE;realPropertyNetworkIdentifier realPropertyNetworkIdentifier VISIBLE NONE;realPropertySiteUniqueID realPropertySiteUniqueID VISIBLE NONE;realPropertyUniqueIdentifier realPropertyUniqueIdentifier VISIBLE NONE;sdsFeatureDescription sdsFeatureDescription VISIBLE NONE;sdsFeatureName sdsFeatureName VISIBLE NONE;sdsMetadataID sdsMetadataID VISIBLE NONE;facilityConditionIndex facilityConditionIndex VISIBLE NONE;facilityIDFK facilityIDFK VISIBLE NONE;facilityNumber facilityNumber VISIBLE NONE;contractNumber contractNumber VISIBLE NONE;dateInService dateInService VISIBLE NONE;diameter diameter VISIBLE NONE;diameterUOM diameterUOM VISIBLE NONE;fittingType fittingType VISIBLE NONE;installationCode installationCode VISIBLE NONE;isCUI isCUI VISIBLE NONE;maximoIDFK maximoIDFK VISIBLE NONE;projectID projectID VISIBLE NONE;utilityOwner utilityOwner VISIBLE NONE;createdDate createdDate VISIBLE NONE;createdBy createdBy VISIBLE NONE;lastEditedBy lastEditedBy VISIBLE NONE;lastEditedDate lastEditedDate VISIBLE NONE;sdsID sdsID VISIBLE NONE;Shape Shape VISIBLE NONE"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Process: Select Layer By Location&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... arcpy.SelectLayerByLocation_management(&lt;SPAN style="color: #737300;"&gt;'GasUtilNode_Segment'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;'BOUNDARY_TOUCHES'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;r'P:\YU_Restricted\Yuma_Admin\Projects\FY18\WO18_100_199\18-190_Gas_Utilities_Update_(Plicka_Joffre)\Gas_Utilites.gdb\UTILITIES_GAS\Fitting2Layer'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;'#'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;'NEW_SELECTION'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;'NOT_INVERT'&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Process: Copy Features&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... arcpy.CopyFeatures_management(GasUtilNode_Segment__3_, results_shp, &lt;SPAN style="color: #737300;"&gt;'#'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;"0"&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;"0"&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;"0"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Process: Get Count&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... arcpy.GetCount_management(results_shp)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Local variables:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... lyrfile = &lt;SPAN style="color: #737300;"&gt;r"P:\\YU_Restricted\\Yuma_Admin\\Projects\\FY18\\WO18_100_199\\18-190_Gas_Utilities_Update_(Plicka_Joffre)\\results.shp"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... result = arcpy.GetCount_management(lyrfile)&lt;/P&gt;&lt;P&gt;... count = int(result.getOutput(&lt;SPAN style="color: #0084a8;"&gt;0&lt;/SPAN&gt;))&lt;/P&gt;&lt;P&gt;... calcuFld = count&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Process: Calculate Field&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... arcpy.CalculateField_management (&lt;SPAN style="color: #737300;"&gt;"GasUtilNode_gControlFitting"&lt;/SPAN&gt;,&lt;SPAN style="color: #737300;"&gt;"mediaID"&lt;/SPAN&gt;,calcuFld)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #808080;"&gt;# Process: Delete &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... arcpy.Delete_management(&lt;SPAN style="color: #737300;"&gt;r'P:\YU_Restricted\Yuma_Admin\Projects\FY18\WO18_100_199\18-190_Gas_Utilities_Update_(Plicka_Joffre)\results.shp'&lt;/SPAN&gt;, &lt;SPAN style="color: #737300;"&gt;'ShapeFile'&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;... arcpy.Delete_management(&lt;SPAN style="color: #737300;"&gt;"Fitting2"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;... arcpy.Delete_management(&lt;SPAN style="color: #737300;"&gt;r'P:\YU_Restricted\Yuma_Admin\Projects\FY18\WO18_100_199\18-190_Gas_Utilities_Update_&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 May 2018 16:32:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132972#M10340</guid>
      <dc:creator>JAJoffre</dc:creator>
      <dc:date>2018-05-21T16:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I loop this to go through the every feature in the layer.</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132973#M10341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jesus,&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use a &lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/data-access/searchcursor-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Search Cursor&lt;/A&gt; to iterate through your feature class.&amp;nbsp; You can specify "OID@" to retrieve the OBJECTID value.&amp;nbsp; You can add the rest of your code within this FOR loop.&amp;nbsp; Ex:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"OID@"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"fcLyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OBJECTID = "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation‍‍‍‍‍‍‍‍‍&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:27:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132973#M10341</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T07:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I loop this to go through the every feature in the layer.</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132974#M10342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only suggestion I would make is to create the feature layer outside of the loop.&amp;nbsp; I have found calling Make Feature Layer within a loop when only working with 1 data set tends to create both performance and memory management issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 May 2018 20:30:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132974#M10342</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-05-21T20:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I loop this to go through the every feature in the layer.</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132975#M10343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You I will work on it first thing tomorrow and probably run into more problems. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 May 2018 23:17:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132975#M10343</guid>
      <dc:creator>JAJoffre</dc:creator>
      <dc:date>2018-05-21T23:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I loop this to go through the every feature in the layer.</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132976#M10344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Once I get it up and running I will create&amp;nbsp;a feature layer outside of the loop.&amp;nbsp;This&amp;nbsp;computer is slow!!!!!!!!!!!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 May 2018 23:18:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-loop-this-to-go-through-the-every-feature/m-p/132976#M10344</guid>
      <dc:creator>JAJoffre</dc:creator>
      <dc:date>2018-05-21T23:18:49Z</dc:date>
    </item>
  </channel>
</rss>

