Select to view content in your preferred language

Need to Drop Band 4 from a 4 Band TIF

16530
12
07-15-2010 03:57 PM
RandyKreuziger
Frequent Contributor
I need to load some new 2009 4-band NAIP data into SDE to support ArcIMS applications.  We don't have enough space to hold the 4-band data but we do if the IR 4th band is dropped.  I need to do this for a few thousand TIFs.
0 Kudos
12 Replies
AARONHOSFORD
Emerging Contributor
Sorry to bother you again,

I have tried putting the 'for loop' in and i am still getting the same results.  I have tried debugging in pyscripter and it keeps failing at:

inTIFF = tifList.Next()

with the same error.  This is very humbling.  Thank you again for the help you have already provided.
0 Kudos
RandyKreuziger
Frequent Contributor
The for loop does away with the need for the "Next()" statements.  Also, arcpy if very case sensitive.  In the code below notice that AddRow is replaced by addRow.  Unfortunately, I don't have any 4 band imagery to test my script.

# Import system modules
import sys, string, os, arcpy

arcpy.env.workspace = "H:/"

tifList = arcpy.ListRasters("*.tif")
for inTIFF in tifList:
    print inTIFF
    outTIFF = "E:/Rasters/NAIP2009/" + inTIFF
    # Create a value table to hold the multivalue parameters for the Union_analysis
    vtab = arcpy.CreateObject("ValueTable")  
    vtab.addRow(inTIFF + "\\Band_1")
    vtab.addRow(inTIFF + "\\Band_2")
    vtab.addRow(inTIFF + "\\Band_3")
    # Process: Composite Bands...
    print "Composite Bands 1 2 3 " + str(inTIFF)
    arcpy.CompositeBands_management(vtab, outTIFF)   
0 Kudos
AARONHOSFORD
Emerging Contributor
Thank you very much.  I changed up the workspace and out location and it worked first try.  You have been a life saver.  Thanks again.

And also thanks for the knowledge!!
0 Kudos