Any Pythoners out there have a label expression that "strips" the preceding 0 from the section number field ([FRSTDIVLAB]) in the cadastral/PLSS section layer (i.e., PLSSFirstDivision). I would like my labels to read "1" rather than "01" as defined in the attribute table.
It appears that a script could be implemented in the label expression to do this. Perhaps there is an easier way? I would like to avoid creating a new numeric field in the attribute table just to make the section number label correctly. Thanks!
Try this out, I think it's getting you close but may need to play with it more than I was able to.
##### Strip leading zeros
def FindLabel ( [UNIQUE_NO] ):
return [UNIQUE_NO].lstrip("0") #.strip removes all zeros
I found this here and this link explains the lstrip method. It seems to only remove the leading zeros, but if Township and Range were in separate fields this could be used two times and the two fields concatenated together to produce the result you want. Hope it helps!
© Montana Association of Geographic Information Professionals
MAGIP is a 501(c)6 non-profit organization in Montana
Full Scope Association and Event Management
1236 North Ave. W, Missoula, MT 59801