Opened 22 years ago

Last modified 22 years ago

#127 closed defect (fixed)

ENVI format half-recognized

Reported by: alessandro_amici@… Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

hi,

gdal 1.1.7 on debian woody with ENVI 3.5
i get the following error messages with float ENVI raster file mos2.bin:

amici@pc3-b:~/devel$ gdalinfo mos2.bin.hdr
ERROR 1: The selected file is an ENVI header file, but to
open ENVI datasets, the data file should be selected
instead of the .hdr file.  Please try again selecting
the data file corresponding to the header file:
  mos2.bin.hdr

GDALOpen failed - 1
The selected file is an ENVI header file, but to
open ENVI datasets, the data file should be selected
instead of the .hdr file.  Please try again selecting
the data file corresponding to the header file:
  mos2.bin.hdr

amici@pc3-b:~/devel$  gdalinfo mos2.bin
ERROR 4: `mos2.bin' not recognised as a supported file format.

GDALOpen failed - 4
`mos2.bin' not recognised as a supported file format.
amici@pc3-b:~/devel$

same with gdal_translate.
the hdr file is:
ENVI
description = {
  File Imported into ENVI.}
samples = 500
lines   = 500
bands   = 1
header offset = 0
file type = ENVI Standard
data type = 4
interleave = bsq
sensor type = Unknown
byte order = 0
map info = {Geographic Lat/Lon, 0.5000, 0.5000, 10100.00000000, 19900.00000000,
1.00000000, 1.00000000, WGS-84, units=Seconds}
geo points = {
 1.5000, 1.5000, 5.58305556, 2.80583333,
 500.5000, 1.5000, 5.58305556, 2.94444444,
 1.5000, 500.5000, 5.44444444, 2.80583333,
 500.5000, 500.5000, 5.44444444, 2.94444444}

-----------
regards
alessandro

Change History (3)

comment:1 by alessandro_amici@…, 22 years ago

hi,I scanned the source code and found the problem:gdal make an extension substitution from .whatever to .hdr, mos2.bin -> mos2.hdr     (WRONG)while ENVI simply appends the .hdr extension to the full name, i.e.:mos2.bin -> mos2.bin.hdrat least this is what I see for ENVI 3.5 (and 3.4, as far as I can remember)renaming mos2.bin.hdr to mos2.hdr is enough for gdal to succeedcheers,alessandro

comment:2 by alessandro_amici@…, 22 years ago

[whoops comment reformatted]

hi,

I scanned the source code and found the problem:
gdal make an extension substitution from .whatever to .hdr, 
mos2.bin -> mos2.hdr     (WRONG)
while ENVI simply appends the .hdr extension to the full name, i.e.:
mos2.bin -> mos2.bin.hdr
at least this is what I see for ENVI 3.5 (and 3.4, as far as I can remember)

renaming mos2.bin.hdr to mos2.hdr is enough for gdal to succeed

cheers,
alessandro

comment:3 by warmerdam, 22 years ago

Alessadnro,

It seems there are a variety of conventions relating the raw data file and
the .hdr.  I have seen situations where the extension of the base file is
replaced by .hdr and others where .hdr is appended to the existing filename. 

I have modified the GDAL ENVI support to support both now. 

Thanks for the feedback!

Best regards,

Note: See TracTickets for help on using tickets.