diff --git a/Modules/Core/Metadata/src/otbImageMetadata.cxx b/Modules/Core/Metadata/src/otbImageMetadata.cxx index 82ee5498cce237eb44bf969c2c3f5c142261b128..da84e636b2edadcfb206604c1fe54c4a12893078 100644 --- a/Modules/Core/Metadata/src/otbImageMetadata.cxx +++ b/Modules/Core/Metadata/src/otbImageMetadata.cxx @@ -481,7 +481,7 @@ void ImageMetadata::Merge(const ImageMetadata& imd) { ImageMetadataBase::Fuse(imd); - for (unsigned int i = 0; i < std::min(Bands.size(), imd.Bands.size()); i++) + for (unsigned int i = 0; i < std::min(Bands.size(), imd.Bands.size()); ++i) { Bands[i].Fuse(imd.Bands[i]); } diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.hxx b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.hxx index 30c089d82932faa7f563bd4cbba123fa4f411857..8959ec2fa9d9898a7cbf1825ee54917fce7288b3 100644 --- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.hxx +++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.hxx @@ -99,8 +99,10 @@ void GenericRSResampleImageFilter::GenerateOutputInfo m_Resampler->UpdateOutputInformation(); this->GraftOutput(m_Resampler->GetOutput()); - // Encapsulate output projRef - this->GetOutput()->m_Imd.Add(MDGeom::ProjectionProj, this->GetOutputProjectionRef()); + // Encapsulate output projRef and metadata + if (this->GetOutputImageMetadata() != nullptr) + this->GetOutput()->m_Imd.Merge(*(this->GetOutputImageMetadata())); + this->GetOutput()->m_Imd.Add(MDGeom::ProjectionWKT, this->GetOutputProjectionRef()); } /** @@ -119,8 +121,8 @@ void GenericRSResampleImageFilter::EstimateOutputRpcM tempPtr->SetRegions(region); // Encapsulate the output metadata in the temp image + tempPtr->m_Imd.Add(MDGeom::ProjectionWKT, this->GetOutputProjectionRef()); tempPtr->SetImageMetadata(*(this->GetOutputImageMetadata())); - tempPtr->m_Imd.Add(MDGeom::ProjectionProj, this->GetOutputProjectionRef()); // Estimate the rpc model from the temp image m_OutputRpcEstimator->SetInput(tempPtr);