Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
see… with the answer by Jason... this worked well for adding dozens of tiles (using hyperlink) without having to manually create a layer for each one. – Michael Miles-Stimson Dec 8 '15 at 2:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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