AnsweredAssumed Answered

Using arcpy.mapping.AddLayer to import raster in RGB instead of single-band stretched symbology

Question asked by zieglerhm_CDMSmith on Oct 9, 2018
Latest reply on Oct 23, 2018 by Dan_Patterson

Hi, I am working with a simple script that imports geo-referenced rasters corresponding to selected polygons in a featureclass layer. The rasters import just fine, but the issue is that they import as single band streched rasters and I have to go into the layer symbology tab under properties and then change the imported rasters to RGB composite individually. Does anyone have any idea how I could skip that manual step and code for this to happen automatically? The relevant code snippet looks like this:


  1. #Fetch selected rasters and add to current map document, first data frame  
  2. mxd = arcpy.mapping.MapDocument("CURRENT")  
  3. df = arcpy.mapping.ListDataFrames(mxd, "*")[0]  
  4. arcpy.AddMessage(len(docs))#DEBUG#  
  5. for i, page in enumerate(docs):  
  6.         arcpy.AddMessage(i)  
  7.         newlayer = arcpy.mapping.Layer(page)  
  8.         arcpy.mapping.AddLayer(df,newlayer, "TOP")  


Thank you!