Auto-Increments/sequence Number based on direction

749
5
01-12-2021 02:58 PM
CCWeedcontrol
Regular Contributor

I have created a fishnet and i need to updated the fields based on increments. Some of the sections need to increase from north to south and from east to west while others need to in crease from south to north and east west. Not really sure how to create the formula because I am not sure how I would write a script to tell it to auto-increment based on what I mentioned? I don't mind making small changes in a script to determine which filed I need and ranges i need to use.

 

0 Kudos
5 Replies
JeffK
by MVP Regular Contributor
MVP Regular Contributor

Just a thought, I’d add 4 temp fields and calculate a range (-1:-x) for n to s, (1:x) for s to n, (-1:-x ) for e to w, (1:x) for w to e and then use the combination of those temp values in a condition statement to determine the field values you need.  Might take some manual entry or initial setup but that way you’ll have some identifiers to work with in your logic.

0 Kudos
CCWeedcontrol
Regular Contributor

Thank you for the reply and suggestion but i am not sure how to incorporate your suggestion.

0 Kudos
DanPatterson
MVP Esteemed Contributor

The basic syntax for creating a grid coding system requires a regular pattern in the grid itself and consistency in the labelling system.  The attached might give you an idea or two.


... sort of retired...
0 Kudos
JeffK
by MVP Regular Contributor
MVP Regular Contributor

Yeah, sorry about that. 

Depending on how many you need to calculate, this process might take longer to set up than to just manually enter the incremented value but to add some explanation to my previous thought:

I was thinking that you could add some temp fields to the fishnet grid FC.  Then select the top row in arcmap, calculate a temp field (i.e. n_to_s) as a positive number (i.e. 10).  Then in the next row of cells south of the first row, select the row, select and calculate the temp field with a incremented number (i.e. 9 or 11 -depending on which -/+ you want to go)...  Then go through and do the same for the columns in another temp field (i.e. w_to_e).  With that done, you can use the values in the two cells to determine if the field you are trying to actually calculate should be incremented or decreased.  For the cells that need incremented, use positives and decreasing you can assign negatives or just check against its neighbors values and if its less, decrease, if its greater, then increase. 

 

Hope this adds some clarity.

0 Kudos
CCWeedcontrol
Regular Contributor

Wow that is pretty involved unfortunately I am not an supper advanced python scripture but I do appreciate the the code. I was thinking more along creating points for each polygon and then doing a spatial join back to the polygons and using  the x,y spatial location to order/sort them to a specific order then how using a field calculator counter to update the attributes. I have been able to create points for each polygon and spatially joining them back to the polygons but lack creating the complexity of the field calculator.

0 Kudos