Hi, David, Thank you for your response. I have followed the documents you posted to convert ENVI file to Geotiff format. A key step for the conversion was to set the GeoTiff parameter of WRITE_TIFF API. Few of the parameter was come from the *.tfw file associated with the Geotif file that I manually convrted in ENVI. The following codes can convert ENVI file to corresponding Geotiff file. However, I am not sure the parameter is suitable for all files in different regions, since I can not test on all of them. Can you comment on this? ... ENVI_FILE_OPEN, file, R_FID=fId ENVI_FILE_QUERY,fId,DIMS=dims,NS=ns,NL=nl,NB=nb,BNAMES=bandNames,FILE_TYPE=fileType,DATA_TYPE=datType; mapInfo = ENVI_GET_MAP_INFO(FID = fId); prj = ENVI_GET_PROJECTION(FID=fId,PIXEL_SIZE=ps,UNITS=unit); data = INDGEN(nb,ns,nl); FOR j = 0L, nb-1 DO BEGIN ; Multiple bands data[j,*,*] = ENVI_GET_DATA(FID=fId,POS=j,DIMS=dims); ENDFOR g_tags = { $ ModelPixelScaleTag: [ps[0], ps[1], 0d], $ ModelTiepointTag:[0.00000000000000000, 0.00000000000000000, 0.00000000000000000, mapInfo.MC[2], mapInfo.MC[3], 0.00000000000000000],$ GTModelTypeGeoKey: 2, $ ; (ModelTypeProjected) GTRasterTypeGeoKey: 1, $ ; (RasterPixelIsArea) GeographicTypeGeoKey: 4326, $ ; (GCS_NAD27) ProjectionGeoKey: 32767, $ ; (user-defined) ProjLinearUnitsGeoKey: 9001, $ ; (Linear_Meter) GEOGLINEARUNITSGEOKEY:9102 $ } fileBaseName = FileBaseName(fileName); outFile = 'D:\PALSAR-2-V2\Geotiff\'+fileBaseName+'.tif'; WRITE_TIFF,outFile,data,/LONG,GEOTIFF=g_tags; ; Delete memory file ENVI_FILE_MNG,ID=fId,/DELETE;
|