Quantcast
Channel: Calculating sequential numbers into sorted table using ArcMap - Geographic Information Systems Stack Exchange
Viewing all articles
Browse latest Browse all 4

Calculating sequential numbers into sorted table using ArcMap

$
0
0

I am using ArcMap 10.3.

Is there a way to calculate a sorted field with sequential numbers in the Field Calculator or using an Update Cursor in ArcPy?

I have seen Sorting feature class to calculate sequential ID field using ArcGIS Field Calculator? that outlines how to calculate sequential numbers, but this is always calculated on FID order, not on sorted order.

#Pre-logic Script Code:rec=0def autoIncrement():     global rec     pStart = 1      pInterval = 1     if (rec == 0):          rec = pStart      else:          rec += pInterval      return rec#Expression:autoIncrement()

An example of what I'm trying to do. I've used an advanced sort to sort by year, month, day, and now want to have sequential numbers in the Seq field. You'll see that my OBJECTID field is not in order, so the above code won't work.

enter image description here


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>