AnsweredAssumed Answered

Help: Batch Repjection of Landsat 8

Question asked by zia207 on Dec 4, 2016
Latest reply on Dec 4, 2016 by zia207

Hi All,

I am trying to reproject  all surface bands of several  Landsat 8 image to a local coordinate system. Following script works fine for all bands of a single sheet  of image.

 

But I would like to  reproject all sheets  by batch processing  and saved them in a another folder with similar sub-folders  name of input  folder.   

 

My input folder structure  like this:

G:\RemoteSensing_Data\Landsat\Landsat_08\Year_2014\Path_136\UTM\LC81360432014002

G:\RemoteSensing_Data\Landsat\Landsat_08\Year_2014\Path_136\UTM\LC81360432014082

G:\RemoteSensing_Data\Landsat\Landsat_08\Year_2014\Path_136\UTM\LC81360442014002

G:\RemoteSensing_Data\Landsat\Landsat_08\Year_2014\Path_136\UTM\LC81360442014082

 

Output folder will be like this

 

G:\RemoteSensing_Data\Landsat\Landsat_08\Year_2014\Path_136\BUTM\LC81360432014002

G:\RemoteSensing_Data\Landsat\Landsat_08\Year_2014\Path_136\BUTM\LC81360432014082

G:\RemoteSensing_Data\Landsat\Landsat_08\Year_2014\Path_136\BUTM\LC81360442014002

G:\RemoteSensing_Data\Landsat\Landsat_08\Year_2014\Path_136\BUTM\LC81360442014082

 

try:
    import arcpy
    arcpy.env.workspace =  r"G:/RemoteSensing_Data/Landsat/Landsat_08/Year_2014/Path_136/UTM/LC81360432014002"
    rasterListA = arcpy.ListRasters("*_sr_*","TIF")
    print(rasterListA)
    # Projection files (.prj)
    inPut_cs = "G:\\RemoteSensing_Data\\Landsat\\Projection_File\\UTM_zone_46_N.prj"
    outPut_cs = "G:\\RemoteSensing_Data\\Landsat\\Projection_File\\BUTM.prj"
    #Projection
    for raster in rasterListA:
        projOutA="G:\\RemoteSensing_Data\\Landsat\\Landsat_08\\Year_2014\\Path_136\\BUTM\\Full\\LC81360432014002\\"+raster
        arcpy.ProjectRaster_management(raster, projOutA, outPut_cs,"BILINEAR", inPut_cs)
except:
    print "Projection failed."
    print arcpy.GetMessages()

I appreciated if some one help me out.

Zia

Outcomes