diff --git a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h index 9fd5a17438d084721fc2bce27f4ad3196a626c2e..6f83a0258f97c93f9332ee2e1812b79c24ac9b50 100644 --- a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h @@ -150,6 +150,9 @@ public: * There values a computed by 6S. */ WavelengthSpectralBandVectorType GetSpectralSensitivity() const override; + void Parse(const MetadataSupplierInterface *) override; + + protected: Spot6ImageMetadataInterface(); ~Spot6ImageMetadataInterface() override diff --git a/Modules/Core/Metadata/src/otbQuickBirdImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbQuickBirdImageMetadataInterface.cxx index c1fc52f2d2c3a6d8d5eb997ac5cedd85a1b4efb9..98aae1ec0a6a404477d6db73ca89744f69bd294c 100644 --- a/Modules/Core/Metadata/src/otbQuickBirdImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbQuickBirdImageMetadataInterface.cxx @@ -955,7 +955,30 @@ QuickBirdImageMetadataInterface::WavelengthSpectralBandVectorType QuickBirdImage } void QuickBirdImageMetadataInterface::Parse(const MetadataSupplierInterface *mds) -{ +{ + assert(mds); + // Check if there is DG metadatas + bool hasValue = false; + auto metadatatype = mds->GetMetadataValue("METADATATYPE", hasValue); + if (!hasValue || metadatatype != "DG") + { + otbGenericExceptionMacro(MissingMetadataException, + << "No Digital Globe metadata has been found") + } + + // Check if the sensor is WorldView 2 + auto sensorID = mds->GetMetadataValue("IMD/IMAGE_1.satId", hasValue); + + if (sensorID.find("QB02") != std::string::npos) + { + m_Imd.Add(MDStr::SensorID, "QB02"); + m_Imd.Add(MDStr::Mission, "Quickbird"); + } + else + { + otbGenericExceptionMacro(MissingMetadataException, << "Not a Quickbird image") + } + FetchRPC(*mds); } diff --git a/Modules/Core/Metadata/src/otbSpot6ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSpot6ImageMetadataInterface.cxx index 4721ae9c950b08b85a01720f20db3ebbf700ddc0..d3fef73884b36fae4dab5faaba3d33a305967977 100644 --- a/Modules/Core/Metadata/src/otbSpot6ImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbSpot6ImageMetadataInterface.cxx @@ -26,6 +26,8 @@ #include "otbImageKeywordlist.h" #include "otbStringUtils.h" +#include "otbDimapMetadataHelper.h" + namespace otb { using boost::lexical_cast; @@ -1252,4 +1254,36 @@ Spot6ImageMetadataInterface::WavelengthSpectralBandVectorType Spot6ImageMetadata return wavelengthSpectralBand; } +void Spot6ImageMetadataInterface::Parse(const MetadataSupplierInterface *mds) +{ + assert(mds); + + std::cout << "Spot6ImageMetadataInterface::Parse" << std::endl; +/* + bool hasValue = false; + auto metadatatype = mds->GetMetadataValue("METADATATYPE", hasValue); + + // DIMAP metadata has already been parsed by gdal + if (hasValue && metadatatype == "DIMAP") + { + DimapMetadataHelper helper(mds); + + helper.ParseRadiometry(m_Imd); + } +*/ + + Fetch(MDStr::SensorID, *mds, "IMAGERY/SATELLITEID"); + if (strncmp(m_Imd[MDStr::SensorID].c_str(), "SPOT 6", 6) == 0) + { + m_Imd.Add(MDStr::Mission, "SPOT 6"); + } + else + { + otbGenericExceptionMacro(MissingMetadataException,<<"Not a spot 6 product") + } + + FetchRPC(*mds); +} + + } // end namespace otb