I am currently having trouble getting 3-band raster's to display correctly when I call the arcpy.mapping.AddLayer() method. It should be said that I am using a pre-existing mxd template to automate the mapping process and output jpg's as the final product.

here is a snippet to demonstrate how I am adding the layers;

    import arcpy

    mxd = arcpy.mapping.MapDocument("path_to_mxd")

    data_frames = arcpy.mapping.ListDataFrames(mxd)

    df = data_frames[0]

    layer = arcpy.mapping.Layer("path_to_layer")

    arcpy.mapping.AddLayer(df, layer, "TOP")

this code adds the layer object but it does not include all bands of the image so what I am left with looks like a negative copy of the original image. I have tried to work around this by including a layer with correct symbology and then using the ApplySymbologyFromLayer_management() method but it does not work and when tried with the python command line in ArcMap, the image(s) display a lock in the bottom right corner of their description in the table of contents. I only want the images to display with RGB composite symbology. Any help would be greatly appreciated and I will check often if more info is needed. Also I did read the post titled: "Is there a way to programatically force RGB (3 bands)" etc... the rasters I am adding already contain 3 bands and arcpy is only adding one in a stretched format so please consider this when answering, Thanks

1 Answer 1


If you can get your raster layer displayed as you want in ArcMap, then I would recommend saving that layer as a layerfile, and then using the layerfile name (with its full path) in place of "path_to_layer" when you create the layer object.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.