Import Composite Raster Layer with arcpy

2072
1
06-21-2011 06:24 AM
ZachRaymer
New Contributor
Hello,

I am currently working on an automated mapping process in arcpy (using arcmap 10).

What I need to do is import two different ".tif" files into separate dataframes. lets call the first tif file "Tif_1" and the second "Tif_2".

so my TOC would look like the following:

DF1:
Tif_1

DF2:
Tif_2
Tif_1

Tif_1 is a 3 band composite image, and Tif_2 is a single band image that i want to show on top of Tif_1

The script i use is the following:

x=0

for tiff in PLlist:

#Get Name of 'tiff'
desc = arcpy.Describe(tiff)
name = desc.baseName

#Insert TrueColor into TrueColor DF
inTClyr = arcpy.mapping.Layer(TClist)
arcpy.mapping.AddLayer(TC,inTClyr,"TOP")
arcpy.ApplySymbologyFromLayer_management(inTClyr,symbTC)
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
#Insert TrueColor into Plume DF
inTClyr2 = arcpy.mapping.Layer(TClist)
arcpy.mapping.AddLayer(PL,inTClyr,"TOP")
arcpy.ApplySymbologyFromLayer_management(inTClyr2,symbTC1)
arcpy.mapping.UpdateLayer(PL,inTClyr2,symbTC1, True)
arcpy.RefreshTOC()
arcpy.RefreshActiveView()

#Insert Plume into Plume DF
inPLlyr = arcpy.mapping.Layer(PLlist)
arcpy.mapping.AddLayer(PL,inPLlyr,"TOP")
arcpy.ApplySymbologyFromLayer_management(inPLlyr,symbPL)
arcpy.RefreshTOC()
arcpy.RefreshActiveView()


However, the problem i am having is that neither of the true color composites ("Tif_1") have their symbologies updated. They both come into their respective dataframes being displayed as single band stretched images, and even though i have saved a .lyr file with symbology as a true color composite the "Tif_1" images fail to accept the new symbology.

**though the code is incomplete here, no errors are presented when i run the code, the symbology layers just don't apply...
0 Kudos
1 Reply
JeffBarrette
Esri Regular Contributor
I think the problem here is that you are mixing symbology renderers and this can't even be done in the UI.

For example, in the UI, add an RGB Composite raster.  Then try to set its datasource to just one of the bands (via the Source tab).  It won't let you.  If you set the symbology properties to be Stretched first (must click OK), then you can change the source to a specific band.

You need to author two different layer files.  One for Composite and one for Stretched.  Don't try to update a composite with a stretched layer file.

I hope this helps,
Jeff
0 Kudos