[gdal-dev] Error writing/reading simple ENVI file
Calogero Mauceri
mauceri at actgate.com
Thu Sep 10 06:10:40 PDT 2020
Hi all,
I am having some problems converting a very simple TIFF file to an ENVI
format one.
The file is one band file with just two values (longitudes around 145 deg).
>gdalinfo test.tiff -mm
Driver: GTiff/GeoTIFF
Files: test.tiff
Size is 2, 1
Coordinate System is `'
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 1.0)
Upper Right ( 2.0, 0.0)
Lower Right ( 2.0, 1.0)
Center ( 1.0, 0.5)
Band 1 Block=2x1 Type=Float64, ColorInterp=Gray
Computed Min/Max=145.333,145.351
I convert the file to ENVI format using gdal_translate command:
>gdal_translate -of ENVI test.tiff test.IMG
The command does not give any errors. When I read back the ENVI file I get
the following error:
>gdalinfo test.IMG -mm
ERROR 1: A marker ID was expected (0xff--) instead of 000028fc
ERROR 1: opj_read_header() failed
gdalinfo failed - unable to open 'my_path\test.IMG'.
I'm not sure why it tries to open the ENVI file using the OpenJPEG reader.
Anyway I'm using GDAL 2.4.4 and OpenJPEG 2.3.0. I tried GDAL 3.1.2, but I
get the same error.
I also tried to gdalinfo the ENVI file with an older version of GDAL
(2.1.1) and it can properly read it. Here is the output
>gdalinfo test.IMG -mm
Driver: ENVI/ENVI .hdr Labelled
Files: test.IMG
test.hdr
Size is 2, 1
Coordinate System is `'
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 1.0)
Upper Right ( 2.0, 0.0)
Lower Right ( 2.0, 1.0)
Center ( 1.0, 0.5)
Band 1 Block=2x1 Type=Float64, ColorInterp=Undefined
Computed Min/Max=145.333,145.351
I wonder whether I'm doing something wrong in creating the file or whether
this is a problem in the ENVI driver.
Attached are both input TIFF and output ENVI file generated by
gdal_translate.
Thanks in advance for your help,
Calogero
--
Calogero Mauceri
Software Engineer
Applied Coherent Technology Corporation (ACT)
www.actgate.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200910/f9febb15/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.tiff
Type: image/tiff
Size: 162 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200910/f9febb15/attachment.tiff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.hdr
Type: application/octet-stream
Size: 131 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200910/f9febb15/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.IMG
Type: application/octet-stream
Size: 16 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200910/f9febb15/attachment-0001.obj>
More information about the gdal-dev
mailing list