Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

the .description of the featureclass itself

$
0
0
Why when I add a layer programmatically does the featureclass description visible in ArcCatalog disappear?

Code:

#Is the .description of the featureclass itself available rather than from the layer object?
           
            print str(cnt) + ", " + fd + ",  " + fc + ",  " + str(count) + ",  " + layname + ",  " + dattype + ",  " + typedat
            mxd = arcpy.mapping.MapDocument("C:\\temp\\test.mxd")
            arcpy.env.workspace = gdb + '\\' + fd
            base_Folder = arcpy.env.workspace
            df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
            outlayer = os.path.join(base_Folder, fc) + "_lyr"
            layerfile = "C:\\temp\\" + fc + ".lyr"
            arcpy.MakeFeatureLayer_management(os.path.join(base_Folder, fc), outlayer)
            arcpy.SaveToLayerFile_management(outlayer, layerfile, "ABSOLUTE")
            addLayer = arcpy.mapping.Layer(outlayer)
            arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")
            arcpy.RefreshTOC()
            arcpy.RefreshActiveView()
            for lyr in arcpy.mapping.ListLayers(mxd):
                print lyr.description
mxd.save() 
del mxd


##Output Line1(First Print Statement is okay):
#1, ADMIN_BOUNDARY,  AZ_cnty_bnd_100,  15,  n,  Simple,  Polygon
##Output Line2(Second Print Statement Same Layer Dropped from Arc Catalog, is okay):
#Hi andy how to retrieve this text from ArcCatalog Description Tab.
##Output Line3(Second Print Statement Same Layer Added with .Addlayer, description disappears):
#C:\temp\awstmp_serverprj_bak\R9GDL_Data_WM\R9GDL_WM.gdb\ADMIN_BOUNDARY\AZ_cnty_bnd_100_lyr


Viewing all articles
Browse latest Browse all 2485

Trending Articles