I have used the Grid index feature tool to create an index grid. The label/attribution of the page names are populated in a "row" orientated manner. eg lef to right a1,a2,a3,a4,a5,a6 b1,b2,b3,b4,b5,b6 c1,c2,c3,c4,c5,c6enter image description here

How can I calculate a field so I can have the page names label/attribution in a "column" orientation?eg: a1,b1,c1,d1,e1 a2,b2,c2,d2,e2 a3,b3,c3,d3,e3 a4,b4,c4,d4,e4


Try this field calculator (Python) on a new text field:

def CN(nCols,nRows,j):
 theDiv = divmod(nC,26); SecondL = theDiv[1]
 FirstL = theDiv[0]; aLetter = chr(65 + FirstL) + chr(65 + SecondL)
 aLabel = aLetter + str(nR).zfill(2)
 return aLabel

CN(42,47, !PageNumber! )

If you want to see this:

enter image description here

  • thanks felix, I still get the row orientated attribution. At my end it doesn't replicate what i expected to see in your diagram. Im just trying to figure out why right now. – Haydlew Jul 21 '15 at 1:02
  • Are "OLD" the same as at my picture? – FelixIP Jul 21 '15 at 1:22
  • yes it the same if I label using the "pageName" field. – Haydlew Jul 21 '15 at 2:04
  • I got it working, I reran a new grid index then ran the calc over it again. My original must have inherited something unseen. Thanks this works great! Even with 10.0 – Haydlew Jul 21 '15 at 2:40
  • Good to know. +1 for not giving up – FelixIP Jul 21 '15 at 2:50

Below is some code extracted from one of my training courses that should be adaptable to your situation:

# Add field to Map Grid to hold grid references created by concatenating 
# outputs from looping values 1 to 8 from North to South and A to H from
# West to East e.g. 1A to 8H for each of 64 maps
rowCount = 0
with arcpy.da.UpdateCursor("MapGrid.shp",["FID","REF"]) as cursor:
    for row in cursor:
        leftPart = (rowCount % 8) + 1
        rightPart = ["A","B","C","D","E","F","G","H"][row[0] % 8]
        row[1] = str(leftPart)+str(rightPart)

        if ((row[0]) % 64) == 63:
            rowCount = rowCount + 1

It produces grid references like those in the picture below:

enter image description here

  • Thanks for the quick response. Thats pretty much what Im after. Only issue I have is that im using arcmap 10.0....update row does not support indexing. :( Time to upgrade i think! – Haydlew Jul 20 '15 at 6:23
  • 1
    Upgrading to 10.1 (preferably all the way to 10.3.1) sounds like a good idea. That 10.0 to 10.1 upgrade was huge for ArcPy because it gives you arcpy.da, Python Add-Ins and Python Toolboxes. – PolyGeo Jul 20 '15 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.