AnsweredAssumed Answered

Why do I get two values for longName??

Question asked by annab64 on Jul 15, 2012
Latest reply on Jul 16, 2012 by annab64
Hi,
New at this.  Practicing my Python coding.   In the first ListLayer I get the full longName for a layer.  In the second code I don't.  Any ideas why?

Code:
TOClayers = ListLayers(mxd)
    for layer in TOClayers:
        print "Layer LongName is : " + layer.longName
        print "Layer name is : " + layer.name

    print"\nStart the dataframe loop."
    dataframes = ListDataFrames(mxd, '')
    for frame in dataframes:
        layers = ListLayers(mxd, '', frame)
        i = 1
        for layer in layers:
            print '\nData Frame : ' + frame.name +'\tLayer longName ' + str(i) + ': ' + layer.longName
            print 'Data Frame : ' + frame.name +'\tLayer Name ' + str(i) + ': ' + layer.name
            i += 1
   Results:
Layer LongName is : Detail Map
Layer name is : Detail Map
Layer LongName is : Detail Map\Streets
Layer name is : Streets
Layer LongName is : Detail Map\Parcels
Layer name is : Parcels
Layer LongName is : Detail Map\Neighborhoods
Layer name is : Neighborhoods
Layer LongName is : Background
Layer name is : Background
Layer LongName is : Background
Layer name is : Background

Start the dataframe loop.

Data Frame : MainLayer Layer longName 1: Detail Map
Data Frame : MainLayer Layer Name 1: Detail Map

Data Frame : MainLayer Layer longName 2: Streets
Data Frame : MainLayer Layer Name 2: Streets

Data Frame : MainLayer Layer longName 3: Parcels
Data Frame : MainLayer Layer Name 3: Parcels

Data Frame : MainLayer Layer longName 4: Neighborhoods
Data Frame : MainLayer Layer Name 4: Neighborhoods

Data Frame : MainLayer Layer longName 5: Background
Data Frame : MainLayer Layer Name 5: Background

Data Frame : Location_Layer Layer longName 1: Background
Data Frame : Location_Layer Layer Name 1: Background

thx,
Anna

Outcomes