<?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 Lat and Long in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19267#M1470</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error indicates that the &lt;STRONG&gt;source&lt;/STRONG&gt; shape is &lt;EM&gt;also&lt;/EM&gt; NULL (or empty). Joshua asked about the shape contents, not the target fields.&amp;nbsp; You can add a "if (row[0] and row[1]):" above your row assignment to prevent the error, with an else to report trouble.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Jun 2017 13:56:30 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2017-06-05T13:56:30Z</dc:date>
    <item>
      <title>UpdateCursor Lat and Long</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19264#M1467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are currently trying to update existing null values with X and Y coordinates.&lt;/P&gt;&lt;P&gt;We are getting an error:&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; &lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt; File "C:\FLRmodel\CalculatePlotNumberByAccess3.py", line 72, in &amp;lt;module&amp;gt;&lt;BR /&gt; row[2] = round(row[0], 6)&lt;BR /&gt;TypeError: a float is required&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;with arcpy.da.UpdateCursor(projectedFC, ['SHAPE@X', 'SHAPE@Y', 'PLOT_LONG', 'PLOT_LAT'], "" , spatialRef) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2] = round(row[0], 6)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[3] = round(row[1], 6)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)&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;P&gt;Why does it ask for a float?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:46:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19264#M1467</guid>
      <dc:creator>JenniferMcCarthy</dc:creator>
      <dc:date>2021-12-10T20:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor Lat and Long</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19265#M1468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is asking for a &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;float&lt;/SPAN&gt; because the round function requires a floating point number to round, or an integer it can convert to a floating point and round back to itself.&amp;nbsp; In short, you are passing it an invalid data type.&amp;nbsp; In your case, since you are talking about NULLs, I suspect you are passing it a &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;None&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before I provide a specific suggestion, do you have records without geometries or with empty geometries?&amp;nbsp; If so, what do you want PLOT_LONG and PLOT_LAT to be in those cases?&amp;nbsp; Just keep them NULL?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2017 13:13:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19265#M1468</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-06-05T13:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor Lat and Long</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19266#M1469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/355556_NULL.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;we have null values that we want to update with projected coordinates. The coordinates will then be rounded to 6 decimal places. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2017 13:27:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19266#M1469</guid>
      <dc:creator>JenniferMcCarthy</dc:creator>
      <dc:date>2017-06-05T13:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor Lat and Long</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19267#M1470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error indicates that the &lt;STRONG&gt;source&lt;/STRONG&gt; shape is &lt;EM&gt;also&lt;/EM&gt; NULL (or empty). Joshua asked about the shape contents, not the target fields.&amp;nbsp; You can add a "if (row[0] and row[1]):" above your row assignment to prevent the error, with an else to report trouble.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2017 13:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19267#M1470</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2017-06-05T13:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: UpdateCursor Lat and Long</title>
      <link>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19268#M1471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Implementing Vince's suggestion:&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;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;projectedFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SHAPE@X'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'SHAPE@Y'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'PLOT_LONG'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'PLOT_LAT'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; spatialRef&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; &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; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &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="operator token"&gt;and&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;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; round&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="number token"&gt;6&lt;/SPAN&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; round&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="number token"&gt;6&lt;/SPAN&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&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;P&gt;&lt;/P&gt;&lt;P&gt;Adding the extra logical check will likely prevent the script from bombing, but it isn't going to address those records where there isn't any geometry or where the geometry is empty.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:46:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updatecursor-lat-and-long/m-p/19268#M1471</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-10T20:46:12Z</dc:date>
    </item>
  </channel>
</rss>

