<?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 Create sequential numbers in a field in ArcMap using Python in the Field Calculator based on longitude in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1194704#M57589</link>
    <description>&lt;P&gt;I'd like to calculate an ID field (or some other numeric field) with consecutive numbers starting with 1. The order of this field will be based on the longitude field since I want to number my points from South to North.&lt;/P&gt;&lt;P&gt;I found this&amp;nbsp;&lt;A href="https://support.esri.com/en/technical-article/000011137" target="_blank" rel="noopener"&gt;https://support.esri.com/en/technical-article/000011137&lt;/A&gt;&amp;nbsp;but it is based on the record number and not a field in the data. I have&amp;nbsp; put a portion of my table below.&lt;/P&gt;&lt;P&gt;Is this possible? This has stumped me for years!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sean_Wray_0-1658439899619.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/46478i625A097812877E5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sean_Wray_0-1658439899619.png" alt="Sean_Wray_0-1658439899619.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2022 22:09:41 GMT</pubDate>
    <dc:creator>Sean_Wray</dc:creator>
    <dc:date>2022-07-21T22:09:41Z</dc:date>
    <item>
      <title>Create sequential numbers in a field in ArcMap using Python in the Field Calculator based on longitude</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1194704#M57589</link>
      <description>&lt;P&gt;I'd like to calculate an ID field (or some other numeric field) with consecutive numbers starting with 1. The order of this field will be based on the longitude field since I want to number my points from South to North.&lt;/P&gt;&lt;P&gt;I found this&amp;nbsp;&lt;A href="https://support.esri.com/en/technical-article/000011137" target="_blank" rel="noopener"&gt;https://support.esri.com/en/technical-article/000011137&lt;/A&gt;&amp;nbsp;but it is based on the record number and not a field in the data. I have&amp;nbsp; put a portion of my table below.&lt;/P&gt;&lt;P&gt;Is this possible? This has stumped me for years!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sean_Wray_0-1658439899619.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/46478i625A097812877E5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sean_Wray_0-1658439899619.png" alt="Sean_Wray_0-1658439899619.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 22:09:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1194704#M57589</guid>
      <dc:creator>Sean_Wray</dc:creator>
      <dc:date>2022-07-21T22:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create sequential numbers in a field in ArcMap using Python in the Field Calculator based on longitude</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1194754#M57597</link>
      <description>&lt;P&gt;I dont have the code, but using python, you could create a list of all objectid,y values,&lt;/P&gt;&lt;P&gt;sort the list ascending (northern hemisphere) and then step through the list and update the corresponding feature's "ID" field&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 22:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1194754#M57597</guid>
      <dc:creator>DavidHoy</dc:creator>
      <dc:date>2022-07-21T22:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create sequential numbers in a field in ArcMap using Python in the Field Calculator based on longitude</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1194757#M57598</link>
      <description>&lt;P&gt;I assume you mean latitude rather than longitude if you want to order it from south to north?&lt;/P&gt;&lt;P&gt;If you don’t mind creating a new dataset, you can use the Sort tool:&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/2.9/tool-reference/data-management/sort.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/2.9/tool-reference/data-management/sort.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It will generate a new ObjectID in order of latitude (or any other existing field). Works both as a tool and in a script.&lt;/P&gt;&lt;P&gt;If you don’t want to generate a new dataset and your data is stored in a geodatabase, then you can create an UpdateCursor with an SQL ORDER BY … clause, and write an ordered index into a new field. This won’t work with a shapefile, though:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;with arcpy.da.SearchCursor(data, "NewIndex", sql_clause=(None, "ORDER BY Latitude")) as cursor:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; index = 1&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; for row in cursor:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; row[0] = index&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;cursor.updateRow(row)&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; index += 1&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/2.9/arcpy/data-access/updatecursor-class.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/2.9/arcpy/data-access/updatecursor-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;— Andy&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 23:19:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1194757#M57598</guid>
      <dc:creator>AndyAnderson</dc:creator>
      <dc:date>2022-07-21T23:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create sequential numbers in a field in ArcMap using Python in the Field Calculator based on longitude</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1233075#M62391</link>
      <description>&lt;P&gt;Just a note, you are using &lt;STRONG&gt;arcpy.da.SearchCursor&lt;/STRONG&gt; in your code here, when I think you intended to use an UpdateCursor.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 01:06:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/create-sequential-numbers-in-a-field-in-arcmap/m-p/1233075#M62391</guid>
      <dc:creator>VinceE</dc:creator>
      <dc:date>2022-11-18T01:06:09Z</dc:date>
    </item>
  </channel>
</rss>

