Take me to pcigeomatics.com

PCI Geomatics Help Center

How can we help you today?

Orthorectification

PCI Geomatics -

'''**********************************************************

	PCI Geomatics(C) - Orthorectification Workflow
	
**********************************************************'''

print ""
print ""
print "***************************************************************"
print ""
print "       -= PCI Geomatics(C) =-"
print "     Orthorectification Workflow"
print ""
print "***************************************************************"

# This script runs the following PPFs in a top-down sequence on one Landsat 7 image
# 1. CDLAND7
# 2. AUTOGCP2
# 3. GCPREFN
# 4. SATMODEL
# 5. ORTHO2

from pci.autogcp2 import autogcp2
from pci.gcprefn import gcprefn
from pci.satmodel import satmodel
from pci.ortho2 import ortho2
from pci.cdland7 import cdland7
from pci.exceptions import *

# ------------------------------------------------
#  Data Setup
# ------------------------------------------------

#The paths provided in this section are examples. Update with the paths to your data before running.
input_data = r"W:\2014_Tutorials\Python\Data\LANDSAT\raw\L71048026_02620000923_HDF.L1G"
ref_image = r"W:\2014_Tutorials\Python\Data\LANDSAT\geo_landsat.pix"
dem_file = r"W:\2014_Tutorials\Python\Data\LANDSAT\dem.pix"
output_dir = r"W:\2014_Tutorials\Python\Data\Output\\"

# Note that the r before the string tells python to ignore the special characters and interpret the 
# entire string as is

# ------------------------------------------------
#  Ingest Landsat 7 imagery
# ------------------------------------------------
in_data = output_dir + "ingest_landsat.pix"

# Parameters for cdland7
filehd = input_data  # Input header file
file = in_data # Output file folder and name
cdic = [1,2,3,4,5]  # Input channels
tex1 = u""  

cdland7(filehd, file, cdic, tex1)
print "Landat 7 imagery ingested"

# ------------------------------------------------
#  GCP Collection and Refinement
# ------------------------------------------------

#Parameters for AUTOGCP2
mfile = in_data    # Input file
dbic = [1]         # Raw input channels
srcbgd = u""       
mmseg = []        
dbgc = []          
filref = ref_image # Input reference image
dbic_ref = []      
filedem = dem_file # Input DEM file
dbec = []      
backelev = []     
elevref = u"" 
elevunit = u"" 
elfactor = []     
smplsrc = u"" 
algo = u"" 
searchr = [50]     # Search Radius     
searchun = u"" 
minscore = [0.75]     
proc = u"" 
numgcps = []      

LASC= autogcp2(mfile, dbic, srcbgd, mmseg, dbgc, filref, dbic_ref, filedem, dbec,\
backelev, elevref, elevunit, elfactor, smplsrc, algo, searchr, searchun, minscore, proc, numgcps)
print "AUTOGCP2 Complete"

#Parameters for GCPREFN
file =  in_data
dbgc = LASC           # Input GCP segment
mmseg = []      
orbit = []      
modeltyp = u"SAT"    # Model Type
order = [0]      
reject = [5,0.5,0.5] # Rejection Method
writecp = u"NO"      # Write check points?
lasc = []      
imstat = []     

gcprefn(file, dbgc, mmseg, orbit, modeltyp, order, reject, writecp, lasc, imstat)
print "GCPREFN Complete"

# ------------------------------------------------
#  Calculate Rigorous Model and Orthorectify
# ------------------------------------------------

gcp_seg = [LASC[0] +1]

#Parameters for SATMODEL
mfile = in_data
dbgc =  gcp_seg     # GCP segment from GCPREFN
orbit = []
mmseg = []      
mapunits = u"" 

satmodel(mfile, dbgc, orbit, mmseg,  mapunits)
print "SATMODEL Complete"

#Parameters for ORTHO2 
mfile = in_data  # Input data
dbic = []      
mmseg = []     
dbiw = []      
srcbgd = u"" 
filo = output_dir + "output_ortho.pix"  # Output ortho imagery
ftype = u"" 
foptions = u"" 
outbgd = []     
ulx = u"" 
uly = u"" 
lrx = u"" 
lry = u"" 
edgeclip = []      
tipostrn = u"" 
mapunits = u"" 
bxpxsz = u"8"  # Horizontal output pixel size
bypxsz = u"8"  # Vertical output pixel size
filedem = dem_file  # Input DEM file
dbec = []      
backelev = []     
elevref = u"" 
elevunit = u"" 
elfactor = []     
proc = u"" 
sampling = []      
resample = u""

ortho2(mfile, dbic, mmseg, dbiw, srcbgd, filo, ftype, foptions, \
outbgd, ulx, uly, lrx, lry, edgeclip, tipostrn, mapunits, bxpxsz, \
bypxsz, filedem, dbec, backelev, elevref, elevunit, elfactor, proc, sampling, resample)
print "ORTHO2 Complete"

print ""
print "End of Workflow"
Have more questions? Submit a request

Comments

Powered by Zendesk