diff --git a/Documentation/SoftwareGuide/Latex/Installation.tex b/Documentation/SoftwareGuide/Latex/Installation.tex
index 5b42bde45442ae35fb66640ed19a1ae07a168283..a5ee979ae22700ea1223bb14cba798cff3b47dd3 100644
--- a/Documentation/SoftwareGuide/Latex/Installation.tex
+++ b/Documentation/SoftwareGuide/Latex/Installation.tex
@@ -4,7 +4,7 @@
 \label{chapter:Installation}
 \index{Installation}
 
-There are two ways to install OTB library on your system: installing from a binary distribution or compiling from sources. 
+There are two ways to install OTB library on your system: installing from a binary distribution or compiling from sources.
 You can find information about the installation of binary packages for OTB and Monteverdi in the OTB-Cookbook.
 
 This chapter covers compilation of OTB library from source. Note that it covers
@@ -20,7 +20,7 @@ It is known to work with the following compilers in 32/64 bit:
 \item AppleClang on Mac~OS~X (10.8 or higher)
 \end{itemize}
 
-Since release version 6.2.0, OTB is compiled using the C++14 standard by default. 
+Since release version 6.2.0, OTB is compiled using the C++14 standard by default.
 
 \index{CMake}
 The challenge of supporting OTB across platforms has been solved through the use of CMake, a cross-platform, open-source
@@ -44,7 +44,7 @@ options specified by the user.
 
 There are (at least) two ways to use CMake :
 \begin{itemize}
-\item Using the command \texttt{ccmake} (on Unix) or \texttt{cmake-gui} (on Windows): 
+\item Using the command \texttt{ccmake} (on Unix) or \texttt{cmake-gui} (on Windows):
 it provides an interactive mode in which you iteratively select
 options and configure according to these options. The iteration
 proceeds until no more options remain to be selected. At this point, a
@@ -207,7 +207,7 @@ If you do not know which method to use and just want to compile OTB with all its
 \texttt{OTB\_WRAP\_JAVA}                & Enable Java wrapper \\
 
 \hline
-\multicolumn{2}{l}{\small \textbf{SuperBuild only}} \\ 
+\multicolumn{2}{l}{\small \textbf{SuperBuild only}} \\
 \texttt{DOWNLOAD\_LOCATION}             & Location to download dependencies \\
 \texttt{USE\_SYSTEM\_\textit{XXX}}      & Use the system's \textit{XXX} library \\
 
@@ -300,7 +300,8 @@ On a GNU/Linux you must have Qt X11 dependencies installed.
 See Qt 5 documentation for list of packages that needs to be installed
 before starting superbuild. https://doc.qt.io/qt-5/linux-requirements.html.
 For a Debian 8.1 system, I installed all Qt5 dependencies with below 'apt-get install'
-\texttt{apt-get install libx11-dev libxext-dev libxt-dev libxi-dev libxrandr-dev libgl-dev libglu-dev}
+\texttt{apt-get install libx11-dev libxext-dev libxt-dev libxi-dev libxrandr-dev
+libgl-dev libglu-dev libxinerama-dev libxcursor-dev}
 
 You can also deactivate QT5 and skip this by passing \texttt{-DOTB\_USE\_QT=OFF} to cmake.
 This will give you OTB install without monteverdi, mapla and gui application launchers.
@@ -454,17 +455,17 @@ Everything that is needed for OTB development on Windows, including compiling fr
 \label{sec:knownissues}
 
 \begin{itemize}
-\item  openjpeg/ITK 
+\item  openjpeg/ITK
 \end{itemize}
 
-It is important to know that the OpenJpeg library doesn't support name mangling since version 2.0. 
-As a consequence, if other libraries linked by your project already contain OpenJpeg, there may be a symbol conflict at run-time. 
-For instance, this was observed with OTB build on a recent ITK version (ver. 4). 
+It is important to know that the OpenJpeg library doesn't support name mangling since version 2.0.
+As a consequence, if other libraries linked by your project already contain OpenJpeg, there may be a symbol conflict at run-time.
+For instance, this was observed with OTB build on a recent ITK version (ver. 4).
 The ITK library already had a version of OpenJpeg in libitkopenjpeg-*.so, which contained the OpenJpeg symbols un-wrapped.
-These symbols were also loaded by the GDAL driver but only the first ones were used, which caused a crash. 
+These symbols were also loaded by the GDAL driver but only the first ones were used, which caused a crash.
 
 Hopefully, thanks to the modular architecture of ITK, the library libitkopenjpeg-*.so is not imported anymore inside OTB.
-However the OpenJPEG headers may be present in ITK include directory. As the current architecture doesn't allow to tune 
+However the OpenJPEG headers may be present in ITK include directory. As the current architecture doesn't allow to tune
 include order between modules, the OpenJPEG header from ITK can be included before your own OpenJPEG install. There are
 two ways to avoid this situation :
 \begin{itemize}
@@ -475,9 +476,8 @@ two ways to avoid this situation :
 More information can be found here : \url{http://wiki.orfeo-toolbox.org/index.php/JPEG2000_with_GDAL_OpenJpeg_plugin}
 
 \begin{itemize}
-\item  libkml / Ubuntu 12.04 
+\item  libkml / Ubuntu 12.04
 \end{itemize}
 
-Another issue is related to the official package of libkml under Ubuntu 12.4.
-Until this problem is addressed, users of this plateform should disable the option OTB\_USE\_KML, so that OTB won't be built with this third-party.
-
+Another issue is related to the official package of libkml under Ubuntu 12.04.
+Users of this plateform should disable the option OTB\_USE\_KML, so that OTB won't be built with this third-party.
diff --git a/Documentation/SoftwareGuide/Latex/OrthoRectification.tex b/Documentation/SoftwareGuide/Latex/OrthoRectification.tex
index f372d4eb5269db49b1f96e341434f7b1a6ea4d55..6d1354cdfc839d926ef206bca9f715723da8cebb 100644
--- a/Documentation/SoftwareGuide/Latex/OrthoRectification.tex
+++ b/Documentation/SoftwareGuide/Latex/OrthoRectification.tex
@@ -158,20 +158,28 @@ OTB, through the use of the OSSIM library --
 sensors either through a physical or an analytical approach. This is
 transparent for the user, since the geometrical model for a given
 image is instantiated using the information stored in its meta-data. The 
-search for a sensor model is not straightforward. It is done in 3 steps :
+search for a sensor model is not straightforward. It is done in several steps :
 \begin{enumerate}
+  \item Load an external \code{.geom} file specified through extended filenames
+(if present)
+  \item Load the \code{.geom} file attached with the input image (if present).
+They share the same name, without extension.
   \item Search in the OSSIM plugin factory for a suitable model 
 (\code{ossimplugins::ossimPluginProjectionFactory}). For instance, this
 factory contains Pl\'eiades and TerraSar sensor models.
   \item If no model was found, search in the OSSIM projection factory 
 (\code{ossimProjectionFactoryRegistry}). For instance this factory contains
 Spot5, Landsat and Quickbird sensor models.
-  \item If still no model was found, search for a valid sensor model defined
- in an external \code{.geom} file. If no model is found, check if there are 
-any RPC tags embedded within the image (GDAL is used to detect those RPC 
-tags). When the tags are present, an \code{ossimRpcModel} is created.
+  \item If no model was found, search any RPC tags in the input image. When the
+tags are present, an \code{ossimRpcModel} is created.
+  \item If still no model was found, search for a valid sensor model in other
+files attached to the current dataset. For instance, with a Sentinel-1 SAFE XML
+product, it will inspect underlying \code{.tiff} files. With a VRT dataset, it
+will inspect the files referenced by the VRT.
 \end{enumerate}
 
+Note that the \code{.geom} metadata file can store any sensor model recognized
+by OSSIM.
 
 \subsection{Using Sensor Models}
 \label{sec:UsingSensorModels}
diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
index 193a93eb09f3325e97d5e7cc7e67adc1a62a24b5..2c0a7d65a730ccfdcc0e1fb1218f6ec33e306ea1 100644
--- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
+++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
@@ -424,7 +424,7 @@ private:
         "initialize cleanup parameter.\n"
         "For more information on shark KMeans algorithm [1].");
 
-    SetDocLimitations("None");
+    SetDocLimitations("The application doesn't support NaN in the input image");
     SetDocAuthors("OTB-Team");
     SetDocSeeAlso("ImageEnveloppe PolygonClassStatistics SampleSelection SamplesExtraction "
       "PolygonClassStatistics TrainVectorClassifier ImageClassifier\n"
diff --git a/Modules/Core/ImageBase/include/otbImageIOBase.h b/Modules/Core/ImageBase/include/otbImageIOBase.h
index ecadb4f00813fa85561d4f75962d3af413b89810..09303fb5bbce2b2fa2e704f38ac311a8e7eb5515 100644
--- a/Modules/Core/ImageBase/include/otbImageIOBase.h
+++ b/Modules/Core/ImageBase/include/otbImageIOBase.h
@@ -429,6 +429,9 @@ public:
    * conversion)*/
   void DoMapBuffer(void* buffer, size_t numberOfPixels, std::vector<unsigned int>& bandList);
 
+  /** Returns a const ref to the list of attached files*/
+  itkGetConstReferenceMacro(AttachedFileNames, std::vector<std::string> );
+
 protected:
   ImageIOBase();
   ~ImageIOBase() override;
@@ -550,6 +553,9 @@ protected:
                                                                unsigned int numberOfActualSplits,
                                                                const itk::ImageIORegion &pasteRegion) const;
 
+  /** List of files part of the same dataset as the input filename */
+  std::vector<std::string> m_AttachedFileNames;
+
 private:
   ImageIOBase(const Self&) = delete;
   void operator=(const Self&) = delete;
diff --git a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
index 9bf14372c6f8a683e797ff38649969f0fac7c3a0..316430596aa58caa73b034110d6ceb30ed1363ed 100644
--- a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
+++ b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
@@ -435,7 +435,7 @@ void GDALImageIO::InternalReadImageInformation()
   // supported gdal format using the m_DatasetNumber value
   // HDF4_SDS:UNKNOWN:"myfile.hdf":2
   // and make m_Dataset point to it.
-  if (m_Dataset->GetDataSet()->GetRasterCount() == 0)
+  if (m_Dataset->GetDataSet()->GetRasterCount() == 0 || m_DatasetNumber > 0)
     {
     // this happen in the case of a hdf file with SUBDATASETS
     // Note: we assume that the datasets are in order
@@ -659,6 +659,24 @@ void GDALImageIO::InternalReadImageInformation()
       }
     }
 
+  // get list of other files part of the same dataset
+  char** datasetFileList = dataset->GetFileList();
+  m_AttachedFileNames.clear();
+  if (datasetFileList != nullptr)
+    {
+    char** currentFile = datasetFileList;
+    while (*currentFile != nullptr)
+      {
+      if (m_FileName.compare(*currentFile) != 0)
+        {
+        m_AttachedFileNames.emplace_back(*currentFile);
+        otbLogMacro(Debug,<<"Found attached file : "<< *currentFile);
+        }
+      currentFile++;
+      }
+    CSLDestroy(datasetFileList);
+    }
+
   /*----------------------------------------------------------------------*/
   /*-------------------------- METADATA ----------------------------------*/
   /*----------------------------------------------------------------------*/
diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.hxx b/Modules/IO/ImageIO/include/otbImageFileReader.hxx
index c26730b0058a322f728ad905c540c7e571796b5b..9e3215277e01a6b92d55cfe398fff4d95a28c9a6 100644
--- a/Modules/IO/ImageIO/include/otbImageFileReader.hxx
+++ b/Modules/IO/ImageIO/include/otbImageFileReader.hxx
@@ -433,7 +433,20 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>
         }
       else
         {
-        otbLogMacro(Info,<< "No kwl metadata found in file "<<lFileNameOssimKeywordlist);
+        // Try attached files
+        for (const std::string& path : m_ImageIO->GetAttachedFileNames())
+          {
+          otb_kwl = ReadGeometryFromImage(path,!m_FilenameHelper->GetSkipRpcTag());
+          if(!otb_kwl.Empty())
+            {
+            otbLogMacro(Info,<< "Loading kwl metadata in attached file "<<path);
+            break;
+            }
+          }
+        if (otb_kwl.Empty())
+          {
+          otbLogMacro(Info,<< "No kwl metadata found in file "<<lFileNameOssimKeywordlist);
+          }
         }
       }
 
diff --git a/Modules/IO/ImageIO/test/CMakeLists.txt b/Modules/IO/ImageIO/test/CMakeLists.txt
index 59b02a6d60000b595ee5f3bbb6bf94356f40541c..f6cbe8fb68c8d9689ed167a1346198265da57de9 100644
--- a/Modules/IO/ImageIO/test/CMakeLists.txt
+++ b/Modules/IO/ImageIO/test/CMakeLists.txt
@@ -75,6 +75,7 @@ otbCompareWritingComplexImage.cxx
 otbImageFileReaderOptBandTest.cxx
 otbImageFileWriterOptBandTest.cxx
 otbMultiImageFileWriterTest.cxx
+otbWriteGeomFile.cxx
 )
 
 add_executable(otbImageIOTestDriver ${OTBImageIOTests})
@@ -1357,3 +1358,12 @@ otb_add_test(NAME ioTvMultiImageFileWriter_DiffSize
   ${TEMP}/ioTvMultiImageFileWriter_DiffSize1.tif
   ${TEMP}/ioTvMultiImageFileWriter_DiffSize2.tif
   25)
+
+otb_add_test(NAME ioTvCompoundMetadataReaderTest
+  COMMAND otbImageIOTestDriver
+  --compare-ascii ${EPSILON_9}
+  ${INPUTDATA}/QB_Toulouse_SensorModel_labelImage.geom
+  ${TEMP}/ioTvCompoundMetadataReaderTest.geom
+  otbWriteGeomFile
+  ${INPUTDATA}/QB_Toulouse_combo.vrt
+  ${TEMP}/ioTvCompoundMetadataReaderTest.tif)
diff --git a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
index 0dab5832434baab0f12df11545fcd93e348858ac..1d59f88e8a8ba93e3616e1efd30f644bfe4ce0db 100644
--- a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
+++ b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
@@ -152,4 +152,5 @@ void RegisterTests()
   REGISTER_TEST(otbImageFileReaderOptBandTest);
   REGISTER_TEST(otbImageFileWriterOptBandTest);
   REGISTER_TEST(otbMultiImageFileWriterTest);
+  REGISTER_TEST(otbWriteGeomFile);
 }
diff --git a/Modules/IO/ImageIO/test/otbWriteGeomFile.cxx b/Modules/IO/ImageIO/test/otbWriteGeomFile.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..5ccf3cb985cb3a7eea1adcb64b9ae6a3108fc46b
--- /dev/null
+++ b/Modules/IO/ImageIO/test/otbWriteGeomFile.cxx
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
+ *
+ * This file is part of Orfeo Toolbox
+ *
+ *     https://www.orfeo-toolbox.org/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "otbVectorImage.h"
+#include "itkMacro.h"
+#include <iostream>
+
+#include "otbImageFileReader.h"
+
+int otbWriteGeomFile(int itkNotUsed(argc), char* argv[])
+{
+
+  // Verify the number of parameters in the command line
+  std::string inputFilename(argv[1]);
+  std::string outputFilename(argv[2]);
+
+  typedef double InputPixelType;
+  const unsigned int Dimension = 2;
+
+  typedef otb::VectorImage<InputPixelType,  Dimension> InputImageType;
+  typedef otb::ImageFileReader<InputImageType>  ReaderType;
+
+  ReaderType::Pointer reader = ReaderType::New();
+  reader->SetFileName(inputFilename);
+  reader->UpdateOutputInformation();
+
+  otb::ImageKeywordlist otb_kwl;
+  itk::MetaDataDictionary &dict = reader->GetOutput()->GetMetaDataDictionary();
+  itk::ExposeMetaData<otb::ImageKeywordlist>(dict, otb::MetaDataKey::OSSIMKeywordlistKey, otb_kwl);
+  if (otb_kwl.Empty())
+    {
+    return EXIT_FAILURE;
+    }
+
+  otb::WriteGeometry(otb_kwl, outputFilename);
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.h b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.h
index 793abaed88c91cf6337dcf77f209919a63a51443..68b44569684f1476e736621a29f707822558c7c7 100644
--- a/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.h
+++ b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.h
@@ -30,6 +30,11 @@
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
 #pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wheader-guard"
+#pragma clang diagnostic ignored "-Wdivision-by-zero"
+#endif
 #endif
 #include "otb_shark.h"
 #include <shark/Algorithms/StoppingCriteria/AbstractStoppingCriterion.h>
diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.h b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.h
index 3752382c36905bc92b8a392017d65eccfbce7dda..598685206dcfed647d0e5ef6d787233171377bd7 100644
--- a/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.h
+++ b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.h
@@ -29,6 +29,10 @@
 #pragma GCC diagnostic ignored "-Wunused-parameter"
 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
 #pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wheader-guard"
+#endif
 #endif
 #include "otb_shark.h"
 #include <shark/Algorithms/Trainers/PCA.h>
diff --git a/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.h
index 0606b5b150a401c7432e8eda1192ae88694cff3a..04bfb698a562eb9bcf8acd7ac5a0fba9668de9a7 100644
--- a/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.h
@@ -34,6 +34,7 @@
 #pragma GCC diagnostic ignored "-Wcast-align"
 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
 #if defined(__clang__)
 #pragma clang diagnostic ignored "-Wheader-guard"
 #endif
diff --git a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h
index 0c8b1502dead68069a70beca72c5c80968a91c58..4625403b99f232178cca94e18506b295196f57b1 100644
--- a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h
+++ b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h
@@ -33,6 +33,10 @@
 #pragma GCC diagnostic ignored "-Wsign-compare"
 #pragma GCC diagnostic ignored "-Wcast-align"
 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wheader-guard"
+#endif
 #endif
 
 #include "otb_shark.h"