Thank you.
I decide top use Envi Classic.
Here my code:
pro idl_layerstacking
COMPILE_OPT IDL2
envi
e = ENVI(/HEADLESS)
; file to be use as base:
base_filename = 'myfilename.dat'
envi_open_file, base_filename, R_FID=base_id, /INVISIBLE, /NO_REALIZE
ENVI_FILE_QUERY, base_id, DIMS=base_dims
base = e.OpenRaster(base_filename)
;print, base.NCOLUMNS
;print, base.NROWS
;print, base.SPATIALREF
out_proj = ENVI_GET_PROJECTION(FID = base_id)
;print, out_proj
; file to be stacked:
new_filename = 'mynewfilename.dat'
envi_open_file, new_filename, R_FID=new_id, /INVISIBLE, /NO_REALIZE
ENVI_FILE_QUERY, new_id, DIMS=new_dims
outputfile = 'mystackedfile' ; without extention
ENVI_DOIT, 'ENVI_LAYERSTACKING_DOIT', DIMS = [base_dims, new_dims], FID = [base_id, new_id],
POS = [0,0,1,2,3,4,5,6,7], ;first 0 is for the first band of the basefile, the other 0,1,2,3,4,5,6,7 refers to the 8th bands of the file to be stacked.
/EXCLUSIVE,
INTERP = 0,
OUT_DT = 4,
OUT_NAME = outputfile,
OUT_PROJ = out_proj,
OUT_PS = [base.NCOLUMNS, base.NROWS],
R_FID = r_fid
I obtain this error message:
Error: "Conflicting data structures:structure tag,DIMS." The result may be invalid.
I have some doubts about the correctness of the expressions of:
DIMS[dimfile1, dimfile2]
FID[fidfile1, fidfile2]
POS[bandpositionfile1, bandpositionfile2]
OUT_PS = [base.NCOLUMNS, base.NROWS]
Can you provide support about the proper use of the ENVI_LAYER_STACKING_DOIT function in the event of multiple files?
I thank you in advance
|