Select to view content in your preferred language

Making sequential number's not based on Object ID number

1964
2
01-26-2019 07:56 AM
DariusBaronas
New Contributor

I have a question about sequential numbering. I found a script (i'll put it below), which allows me to make a sequential numbering based on OID and thats good. But what i need is different structure of numbering... for example, sometimes i need numbering from top to bottom of polygons line, sometimes from left to right or from bottom to top and so on. I'am using Arcgis pro (but example is made using simple arcmap)

Code block:

rec=0 def autoIncrement(string_prefix): global rec pStart = 1 #adjust start value, if req'd pInterval = 1 #adjust interval value, if req'd if (rec == 0): rec = pStart else: rec = rec + pInterval return string_prefix + str (rec).

autoIncrement("24-1-(this number is changes sequentially"))

0 Kudos
2 Replies
JoshuaBixby
MVP Esteemed Contributor

Whether you are numbering by attribute or spatial location, you have to come up with some rules/criteria for grouping and ordering the numbers.  For attributes it is quite straight forward, and there are numerous examples on GeoNet.  For spatial numbering, it gets more complicated very quickly.  Looking at your screenshot, it will be tough to implement the numbering scheme you want by running a script.  What I recommend is considering creating a grid of some form (size and origin would have to be determined through experimentation), and the polygons get labelled by the majority area representation in that grid.

0 Kudos
GIS-Chops
New Contributor III

How many features do you need to number? Have you tried the sequential numbering tool? I just published a video describing how it works.  ArcGIS Pro Tools: Sequential Numbering Tool - Tool Belt Tuesday - YouTube