adding raster data from a file gdb to the current mxd  TOC using python

Discussion created by schaperd on Oct 17, 2012
Latest reply on Oct 18, 2012 by jskinner-esristaff
I want to create a toolbox using python that adds two sets of raster data located in a gdb into my current .mxd

The best that I can do is create some new layer and then have it adds into the TOC but then it disappears when the tool completes:  It is also not the original name for the raster but the name with an added number.  I want to add the original raster and its original name.  I used 'n' in the for loop so that I could add an index to the name.


    mxd = arcpy.mapping.MapDocument("CURRENT")
    df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
    for n in range(len(fc_list)):

        arcpy.MakeRasterLayer_management(fc, xxx)
        addLayer = arcpy.mapping.Layer(xxx)