Hi, everybody, I had experienced a problem when try to restore the map info from a ENVI hdr file, which was derived from LEDAPS correction. A HDF associated with a ENVI header file that contains geographic information.
A sample of the ENVI hdr file associated with the HDF file was like this:
ENVI
description = {LEDAPS HDF File Imported into ENVI}
samples = 7961
lines = 7021
bands = 1
header offset = 0
file type = HDF Scientific Data
data type = 2
interleave = bsq
sensor type = Landsat
byte order = 0
map info = {UTM, 1.000, 1.000, 253185.000000, 2343015.000000, 30.000000, 30.000000, 49, North, WGS-84, units=Meters}
Now I try to read the HDF file and layerstacking all their bands to a ENVI standard file, of course, including restore the map info. I use ENVI_MAP_INFO_CREATE restore their mapinfo as follow:
mapInfo = ENVI_MAP_INFO_CREATE(/UTM,$ ;/UTM
ZONE=49,$
DATUM='D_WGS_1984',$
UNITS=ENVI_TRANSLATE_PROJECTION_UNITS('Meters'),$
PS=[30.0D,30.0D],$
MC=[1.000, 1.000, 253185.000000, 2343015.000000]);
And write each band in memory using code like this:
FOR i=0,bandCnt-1 DO BEGIN
ENVI_WRITE_ENVI_FILE,FUN_GetHDFBand(hdfFileName,bandName[i]),BNAME=bandName[i],/IN_MEMORY,MAP_INFO=mapInfo,R_FID=id
o_fid[i]=id;
ENDFOR
Then layerstacking all bands. The code works fine but I found there is one pixel shift when I open the output file. The hdr file for the output file was like this:
ENVI
description = {
Composite File Result [Sat Jun 14 14:56:08 2014]}
samples = 7961
lines = 7021
bands = 9
header offset = 0
file type = ENVI Standard
data type = 2
interleave = bsq
sensor type = Unknown
byte order = 0
map info = {UTM, 1.000, 1.000, 253155.000, 2343045.000, 3.0000000000e+001, 3.0000000000e+001, 49, North, WGS-84, units=Meters}
coordinate system string = {PROJCS["UTM_Zone_49N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",111.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]}
wavelength units = Unknown
band names = {
band1, band2, band3, band4, band5, band7, atmos_opacity, lndsr_QA, band6}
Can anyone tell me how to solve this problem? Thank you!
|