Menu
Log in

PLSS Labeling

  • 04/27/2015 2:29 PM
    Message # 3319238
    Anonymous

    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!



  • 05/18/2015 9:49 AM
    Reply # 3347119 on 3319238
    Curtis DeVault (Administrator)

    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!

  • 05/20/2015 9:09 AM
    Reply # 3349861 on 3319238
    Anonymous
    Works perfect.  I owe you a beer.  Thanks, Curtis!


Powered by Wild Apricot Membership Software