<?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: Iterate features and select by location in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6208#M540</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are not actually sub-setting your tracts layer in anyway, you have looped over them but done nothing with them. You can either make a temporary layer as &lt;A href="https://community.esri.com/migrated-users/5327"&gt;Neil Ayres&lt;/A&gt;‌ suggests or select the tract in question using a select by attribute tool. As geo-processing always honour selections your select by location would behave as expected. You select parcels that full within the selected tract; as you have it now you are selecting parcels that full within &lt;EM&gt;all tracts&lt;/EM&gt; as you have not actually sub-setted them in anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On a side note I would also get into the habit of specify all the parameters of the tools as it makes debugging easier. For example what selection type is your select by location using?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Nov 2018 10:24:19 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2018-11-14T10:24:19Z</dc:date>
    <item>
      <title>Iterate features and select by location</title>
      <link>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6206#M538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've seen many similar questions but somehow never found an answer that I can understand and apply to my problem. I have a layer&amp;nbsp;with Census tracts. I have a layer with parcels. I need to iterate through each tract, select the parcels falling inside, do some things to the parcels (for the sake of testing, I'm trying to copy the parcels in each tract into a new feature class named with the tract number), then repeat for the next tract. The loop works, insofar as it runs through each tract and creates a new feature class that is named with the tract number. But rather than each feature class containing only the parcels falling inside the respective tract, each&amp;nbsp;resulting feature class includes all parcels falling inside all tracts. I'm clearly missing some important construct in my loop. Please help!&lt;/P&gt;&lt;P&gt;&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;&lt;SPAN class="string token"&gt;"tracts"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TRACT_NUMBER"&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; &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; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"parcels"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"HAVE_THEIR_CENTER_IN"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"tracts"&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_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"parcels"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"parcels_"&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"{}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation 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;&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:15:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6206#M538</guid>
      <dc:creator>JeffThomasILM</dc:creator>
      <dc:date>2021-12-10T20:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate features and select by location</title>
      <link>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6207#M539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you will have to create a layer first, before the select by location.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/make-feature-layer.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/make-feature-layer.htm"&gt;Make Feature Layer—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 08:17:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6207#M539</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2018-11-14T08:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate features and select by location</title>
      <link>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6208#M540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are not actually sub-setting your tracts layer in anyway, you have looped over them but done nothing with them. You can either make a temporary layer as &lt;A href="https://community.esri.com/migrated-users/5327"&gt;Neil Ayres&lt;/A&gt;‌ suggests or select the tract in question using a select by attribute tool. As geo-processing always honour selections your select by location would behave as expected. You select parcels that full within the selected tract; as you have it now you are selecting parcels that full within &lt;EM&gt;all tracts&lt;/EM&gt; as you have not actually sub-setted them in anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On a side note I would also get into the habit of specify all the parameters of the tools as it makes debugging easier. For example what selection type is your select by location using?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 10:24:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6208#M540</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2018-11-14T10:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate features and select by location</title>
      <link>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6209#M541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did something similar a year or so ago and the basic logic was this (adjusted for your use): Loop through your tracts and select a tract as you go.&amp;nbsp; Then you can select the parcels within that selected tract and do your mojo. Step to the next tract, make a &lt;EM&gt;new&lt;/EM&gt; selection for it, and then a new spatial selection etc.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fields &lt;SPAN class="operator token"&gt;=&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="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'TRACT_NUMBER'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'tracts'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'tractsLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'parcels'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'parcelsLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&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;&lt;SPAN class="string token"&gt;'tractsLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fields&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;
  &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;
    select &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OBJECTID = {}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation 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;        
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'tractsLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'NEW_SELECTION'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;select&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'parcelsLyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'HAVE_THIER_CENTER_IN'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;'tractsLyr,'&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;NEW_SLECTION'&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"parcelsLyr"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'parcels_{}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&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;/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;P&gt;&amp;nbsp;This is untested so buyer beware.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:15:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6209#M541</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-10T20:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate features and select by location</title>
      <link>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6210#M542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am dealing with something similar to the original question from Jeff Thomas.&lt;/P&gt;&lt;P&gt;The difference is that instead of copying the selected features, I need to create a new field and add some values to those features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Import arcpy

&lt;SPAN style="color: #808080;"&gt;# Set two geoprocessing environments
&lt;/SPAN&gt;arcpy.env.workspace = &lt;SPAN style="color: #6a8759;"&gt;r"D:\APRX, MXDS\Geo_Engine_Zoning_Project\Austin_Geo_Engine.gdb"
&lt;/SPAN&gt;arcpy.env.overwriteOutput = &lt;SPAN style="color: #cc7832;"&gt;True
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# List of fields in Merged_Ovelays FC
&lt;/SPAN&gt;fields = [&lt;SPAN style="color: #6a8759;"&gt;"OBJECTID"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"zoning_ove"&lt;/SPAN&gt;]

&lt;SPAN style="color: #808080;"&gt;# Convert austin_parcels feature class to feature layer
&lt;/SPAN&gt;arcpy.MakeFeatureLayer_management(&lt;SPAN style="color: #6a8759;"&gt;"austin_parcels"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"austin_parcels_layer"&lt;/SPAN&gt;)

&lt;SPAN style="color: #808080;"&gt;# Convert Merged_Overlays feature class to feature layer
&lt;/SPAN&gt;arcpy.MakeFeatureLayer_management(&lt;SPAN style="color: #6a8759;"&gt;"Merged_Overlays"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Merged_Overlays_Layer"&lt;/SPAN&gt;)

&lt;SPAN style="color: #808080;"&gt;# arcpy.da.SearchCursor(in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {sql_clause})
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;with &lt;/SPAN&gt;arcpy.da.SearchCursor(&lt;SPAN style="color: #6a8759;"&gt;"Merged_Overlays_Layer"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;fields) &lt;SPAN style="color: #cc7832;"&gt;as &lt;/SPAN&gt;cursor:
    &lt;SPAN style="color: #cc7832;"&gt;for &lt;/SPAN&gt;row &lt;SPAN style="color: #cc7832;"&gt;in &lt;/SPAN&gt;cursor:
        select = &lt;SPAN style="color: #6a8759;"&gt;"OBJECTID = {}"&lt;/SPAN&gt;.format(row[&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;])
&lt;SPAN style="color: #808080;"&gt;# SelectLayerByAttribute(in_layer_or_view, {selection_type}, {where_clause}, {invert_where_clause})
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;arcpy.management.SelectLayerByAttribute(&lt;SPAN style="color: #6a8759;"&gt;"Merged_Overlays_Layer"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;select)
&lt;SPAN style="color: #808080;"&gt;# SelectLayerByLocation(in_layer, {overlap_type}, {select_features}, {search_distance}, {selection_type}, {invert_spatial_relationship})
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;arcpy.management.SelectLayerByLocation(&lt;SPAN style="color: #6a8759;"&gt;"austin_parcels_layer"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"HAVE_THEIR_CENTER_IN"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Merged_Overlays_Layer"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;""&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"NEW_SELECTION"&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;# Syntax: AddField(in_table, field_name, field_type, {field_precision}, {field_scale}, {field_length}, {field_alias}, {field_is_nullable}, {field_is_required}, {field_domain})
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;arcpy.management.AddField(&lt;SPAN style="color: #6a8759;"&gt;'austin_parcels_layer'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Overlay_{}"&lt;/SPAN&gt;.format(row[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;])&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"TEXT"&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;# CalculateField(in_table, field, expression, {expression_type}, {code_block}, {field_type})
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;        &lt;/SPAN&gt;arcpy.management.CalculateField(&lt;SPAN style="color: #6a8759;"&gt;"austin_parcels_layer"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Overlay_{}"&lt;/SPAN&gt;.format(row[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;])&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'"Overlay_{}".format(row[1])'&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;I am getting the following error and I am not sure how to fix it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "&amp;lt;string&amp;gt;", line 24, in &amp;lt;module&amp;gt;&lt;BR /&gt; File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 4230, in CalculateField&lt;BR /&gt; raise e&lt;BR /&gt; File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 4227, in CalculateField&lt;BR /&gt; retval = convertArcObjectToPythonObject(gp.CalculateField_management(*gp_fixargs((in_table, field, expression, expression_type, code_block), True)))&lt;BR /&gt; File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 506, in &amp;lt;lambda&amp;gt;&lt;BR /&gt; return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (&lt;A href="http://esriurl.com/support" target="_blank"&gt;http://esriurl.com/support&lt;/A&gt;) to Report a Bug, and refer to the error help for potential solutions or workarounds.&lt;BR /&gt;Invalid pointer&lt;BR /&gt;Failed to execute (CalculateField).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it something with my line of code that is not working?&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.management.CalculateField(&lt;SPAN style="color: #6a8759;"&gt;"austin_parcels_layer"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Overlay_{}"&lt;/SPAN&gt;.format(row[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;])&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;'"Overlay_{}".format(row[1])'&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;My goal is to:&lt;/P&gt;&lt;P&gt;Copy the text from the selected feature below:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" height="197" src="https://community.esri.com/legacyfs/online/484180_pastedImage_1.jpg" width="397" /&gt;&lt;/P&gt;&lt;P&gt;and put it into the newly created field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" height="163" src="https://community.esri.com/legacyfs/online/484217_pastedImage_2.jpg" width="453" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would really appreciate your help,&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;Natalia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:15:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6210#M542</guid>
      <dc:creator>NataliaGutierrez1</dc:creator>
      <dc:date>2021-12-10T20:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate features and select by location</title>
      <link>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6211#M543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Natalia-&amp;nbsp; I've got one foot out the door, but if you would be so kind as to copy your code and paste it into the Syntax Highlighter, I'll take a look at it first thing in the morning.&amp;nbsp; I'm on Mountain Standard Time in the USA...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2020 00:06:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-features-and-select-by-location/m-p/6211#M543</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-03-06T00:06:12Z</dc:date>
    </item>
  </channel>
</rss>

