<?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: UpdateCursor requires Spatial Index Recalculation bug in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1285005#M68697</link>
    <description>&lt;P&gt;Have you tried Recalculate Index from the properties of the feature layer in the TOC?&amp;nbsp; Perhaps there is a programmatic way to do that, but it's a 15 second thing, then wait a minute + for the maps to refresh.&lt;/P&gt;</description>
    <pubDate>Tue, 02 May 2023 22:29:36 GMT</pubDate>
    <dc:creator>ZacharyUhlmann1</dc:creator>
    <dc:date>2023-05-02T22:29:36Z</dc:date>
    <item>
      <title>UpdateCursor requires Spatial Index Recalculation bug</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1259001#M65625</link>
      <description>&lt;P&gt;I'll keep it simple.&amp;nbsp; Every time I run &lt;STRONG&gt;arcpy.da.UpdateCursor()&lt;/STRONG&gt; either via the Python console, a Notebook or with a Python script to update an attribute table, the entire feature layer disappears from the map.&amp;nbsp; Additionally, other feature layers disappear from the map (still present Table of Contents).&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.UpdateCursor('feat_in_TOC', ['fld_name']) as cursor:
    for r in cursor:
        new_val = '{}_new'.format(r[0])
        r[0] = new_val
        cursor.updateRow(r)
del cursor&lt;/LI-CODE&gt;&lt;P&gt;After running (successfully!) the feature layer has disappeared from the map.&amp;nbsp; To fix this, I have to go to &lt;STRONG&gt;Recalculate the Index&lt;/STRONG&gt; via the feature Properties --&amp;gt; Indexes --&amp;gt; Spatial Index dropdown --&amp;gt; Recalculate.&amp;nbsp; The feature layer returns.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the code sample has been run with different variations, field types, etc. - always same result.&amp;nbsp; Just a simple example.&lt;/P&gt;&lt;P&gt;Note that this has been occurring since version 2.&amp;lt;8 and 9&amp;gt; ( &lt;A href="https://community.esri.com/t5/forums/postpage/board-id/arcgis-pro-questions" target="_blank"&gt;https://community.esri.com/t5/forums/postpage/board-id/arcgis-pro-questions&lt;/A&gt; ), so it's not a version thing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is going on?&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Zach&lt;/P&gt;&lt;P&gt;Pro 3.02&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 18:34:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1259001#M65625</guid>
      <dc:creator>ZacharyUhlmann1</dc:creator>
      <dc:date>2023-02-16T18:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor requires Spatial Index Recalculation bug</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1284804#M68656</link>
      <description>&lt;P&gt;Any update on this?&amp;nbsp; It's killing me.&amp;nbsp; Anyone know of a workaround?&lt;/P&gt;&lt;P&gt;-Joe&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 16:28:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1284804#M68656</guid>
      <dc:creator>JosephMelchiors</dc:creator>
      <dc:date>2023-05-02T16:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor requires Spatial Index Recalculation bug</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1284816#M68660</link>
      <description>&lt;P&gt;Oh man!&amp;nbsp; Glad somebody else noticed this issue.&amp;nbsp; I haven't heard anything.&amp;nbsp; I never reported the bug.&amp;nbsp; If I do, I'll add a comment here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is&amp;nbsp;&lt;STRONG&gt;arcpy.da.updateCursor&lt;/STRONG&gt; the culprit for you?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.&amp;lt;something&amp;gt;Cursor as cursor:
    # do some stuff; 
    # I imagine it's when using da.UpdateCursor
del cursor&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 16:37:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1284816#M68660</guid>
      <dc:creator>ZacharyUhlmann1</dc:creator>
      <dc:date>2023-05-02T16:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor requires Spatial Index Recalculation bug</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1285003#M68696</link>
      <description>&lt;P&gt;I found a workaround that works quickly, at least for me.&amp;nbsp; If I just copy the feature layer to itself (after I'm done with my cursor loop), it updates both my deletes and edits and keeps everything else in place.&amp;nbsp; Not elegant, but at least I'm not banging my head against the wall anymore.&lt;/P&gt;&lt;P&gt;#this refreshes the feature layer so deleted are removed&lt;BR /&gt;arcpy.management.CopyFeatures("flyrData", "flyrData")&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 22:24:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1285003#M68696</guid>
      <dc:creator>JosephMelchiors</dc:creator>
      <dc:date>2023-05-02T22:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor requires Spatial Index Recalculation bug</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1285005#M68697</link>
      <description>&lt;P&gt;Have you tried Recalculate Index from the properties of the feature layer in the TOC?&amp;nbsp; Perhaps there is a programmatic way to do that, but it's a 15 second thing, then wait a minute + for the maps to refresh.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 22:29:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/updatecursor-requires-spatial-index-recalculation/m-p/1285005#M68697</guid>
      <dc:creator>ZacharyUhlmann1</dc:creator>
      <dc:date>2023-05-02T22:29:36Z</dc:date>
    </item>
  </channel>
</rss>

