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

arcpy.mapping.AddLayer (SDE Feature Class)

$
0
0
When adding an ArcSDE Feature Class to an .mxd, it only shows the first 3 letters of the name in the TOC.

Code:


    arcpy.env.workspace = "C:\\Users\\me\\AppData\\Roaming\ESRI\\Desktop10.1\\ArcCatalog\\mysdeserver.sde"
    sdelist = arcpy.ListFeatureClasses()
    for sdeFC in sdelist:
        ## locate the desired fc and add it to the TOC
        if sdeFC == 'GIS.THE_FEATURE_CLASS_NAME':
            sdeLyr = arcpy.mapping.Layer(sdeFC)
            arcpy.mapping.AddLayer(df, sdeLyr, "BOTTOM")
            arcpy.mapping.AddLayer
            arcpy.RefreshTOC()

The above code adds the feature class but it adds it with the name "GIS". Am I completely using the wrong method (I don't see any other way). Solution? Comments?


Thanks!

Viewing all articles
Browse latest Browse all 2485

Trending Articles