<?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: Accessing Shape field for point feature class through UpdateCursor causes crash in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/accessing-shape-field-for-point-feature-class/m-p/673221#M22372</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Andy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; I wanted to pass along a very big "Thank You" for posting this fix. I have spent an embarrassing amount of time tracking down this error. I forgot to add Shape as a field for my update cursor as well. I know I never would have figured that out on my own. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jun 2012 17:53:58 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2012-06-08T17:53:58Z</dc:date>
    <item>
      <title>Accessing Shape field for point feature class through UpdateCursor causes crash</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/accessing-shape-field-for-point-feature-class/m-p/673219#M22370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am attemping to snap points in a feature class to their nearest points on a line feature.&amp;nbsp; See the code mentioned here: &lt;/SPAN&gt;&lt;A href="http://blog.rtwilson.com/how-to-snap-points-to-lines-in-arcgis-with-python/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://blog.rtwilson.com/how-to-snap-points-to-lines-in-arcgis-with-python/&lt;/A&gt;&lt;SPAN&gt; I've been playing with this code in ArcGIS 10.0 with Windows 7 Enterprise 64 bit using the Python window where all the data is in a geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem is when the script gets to the iterative use of UpdateCursor to access the point feature to iteratively update the shape (with the new point), I get an error in execution. When I moved to trying to move through the loop I found that the code failed when trying to update the actual Shape field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In an attempt to debug this, I tried to manually access the point feature's shape object:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# updated each point using a cursor
rows = arcpy.UpdateCursor( inputFeature, "", "", "NEAR_X, NEAR_Y" )
row = rows.next()

# attempt to access point object
p = arcpy.getValue("Shape")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The last line will always crash ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have attempted the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Check geometry&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Repair geometry&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Tried moving the cursor forward 6-7 times to make sure it wasn't a specific feature in the class that had the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;None of these have yielded any result, attempts to access the Shape field programatically still cause ArcMap to crash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where do I go next?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:24:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/accessing-shape-field-for-point-feature-class/m-p/673219#M22370</guid>
      <dc:creator>AndyGarcia</dc:creator>
      <dc:date>2021-12-12T04:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Shape field for point feature class through UpdateCursor causes crash</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/accessing-shape-field-for-point-feature-class/m-p/673220#M22371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found the problem (which was two-fold).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First I was setting the x and y members of the new Point class, not the X and Y.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Second, the script I referenced used row.shape = p to change the shape, while I was using row.setValue( "Shape", p). In my case, this caused a crash because Shape was not part of the UpdateCursor field, so I added Shape as a field. This now executes as expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why not a better error message when attempting to set a field via an UpdateCursor where the field was not selected?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why the difference between Point.x/Point.y and Point.X/Point.Y?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2011 13:43:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/accessing-shape-field-for-point-feature-class/m-p/673220#M22371</guid>
      <dc:creator>AndyGarcia</dc:creator>
      <dc:date>2011-03-30T13:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Shape field for point feature class through UpdateCursor causes crash</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/accessing-shape-field-for-point-feature-class/m-p/673221#M22372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Andy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; I wanted to pass along a very big "Thank You" for posting this fix. I have spent an embarrassing amount of time tracking down this error. I forgot to add Shape as a field for my update cursor as well. I know I never would have figured that out on my own. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 17:53:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/accessing-shape-field-for-point-feature-class/m-p/673221#M22372</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-06-08T17:53:58Z</dc:date>
    </item>
  </channel>
</rss>

