Skip to content
Snippets Groups Projects
Commit 60156b42 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

BUG: Don't try to open hdr file when looking for rpc tag because this makes...

BUG: Don't try to open hdr file when looking for rpc tag because this makes the ENVI driver throw an error
parent 567e66be
Branches
Tags
No related merge requests found
......@@ -22,6 +22,7 @@
#include "otbConfigurationManager.h"
#include <cassert>
#include <itksys/SystemTools.hxx>
#include "otbMacro.h"
......@@ -344,6 +345,17 @@ ImageKeywordlist ReadGeometryFromRPCTag(const std::string& filename)
ossimKeywordlist geom_kwl;
ImageKeywordlist otb_kwl;
// Don't call GDALIdentifyDriver on a hdr file because this makes the ENVI driver throw an 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"
// No driver can open hdr file anyway.
std::string extension = itksys::SystemTools::GetFilenameLastExtension(filename);
if ((extension == ".HDR") || (extension == ".hdr"))
{
return otb_kwl;
}
// try to use GeoTiff RPC tag if present.
// Warning : RPC in subdatasets are not supported
GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), nullptr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment