Reading a ENVI dataset with ImageFileReader
result in the following error :
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: CupriteAVIRISSubset.hdr
even is the file is successfully opened.
When reading the input image (in ImageFileReader::GenerateOutputInformation
), there is different ways to read the geometric information and build the otb::ImageKeywordList
, by order of priority :
&skipgeom
is set to true
&geom
inputfilename.geom
)ossimPluginProjection
ossimProjection
Then for each attached file
ossimPluginProjection
ossimProjection
The "attached file" are a list of files associated with the input filename, given by the gdal driver used to open the input image, in this case the ENVI driver. For the ENVI driver the attached files are the header and eventually the stat file.
In the case of the input data considered in this issue, there is no geom information attached, and no rpc in the envi dataset, so all 9 cases are tested and don't return anything. In particular steps 7 8 and 9 are applied to the .hdr
file.
In particular in case 9 OTB tries to read the .hdr file as a GDAL dataset. GDALIdentifyDriver(...)
is used. This method tries to find a driver able to open the file in the list of available gdal drivers. To do so for each driver the Identify() method of the driver is called, and if this method is not implemented (which is the case for the ENVI driver) the driver tries to open the file. So at some point the ENVI driver tries to open the .hdr file, resulting in this error. The driver the return a null dataset, step 9 does not return anything, no keyword list is built and the application continue.
So this error message is just noise. But it is a bit confusing, so it would be nice to be able to remove it ...
It is important to note that if there were RCPs in the ENVI dataset they would be read by GDAL in step 6, not 9 (even if the information is stored in the .hdr)
closes #1995
Don't try to open the hdr file in ossimKeywordList
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i
on latest changes and commit