diff --git a/Code/Projections/otbGenericRSTransform.txx b/Code/Projections/otbGenericRSTransform.txx index 9d9bd92fc1a86bbad8b52b2a621e9678024a5aa5..fc8c08b1f58c916a9076d727a3fc78ce8413aa40 100644 --- a/Code/Projections/otbGenericRSTransform.txx +++ b/Code/Projections/otbGenericRSTransform.txx @@ -152,16 +152,18 @@ GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions> if (!m_DEMDirectory.empty()) { sensorModel->SetDEMDirectory(m_DEMDirectory); + + // Set Geoid file only if used is used + if (!m_GeoidFile.empty()) + { + sensorModel->SetGeoidFile(m_GeoidFile); + } } else if (m_AverageElevation != -32768.0) { sensorModel->SetAverageElevation(m_AverageElevation); } - if (!m_GeoidFile.empty()) - { - sensorModel->SetGeoidFile(m_GeoidFile); - } m_InputTransform = sensorModel.GetPointer(); inputTransformIsSensor = true; otbMsgDevMacro(<< "Input projection set to sensor model."); @@ -226,17 +228,17 @@ GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions> if (!m_DEMDirectory.empty()) { sensorModel->SetDEMDirectory(m_DEMDirectory); + // set the geoid file if any only when dem is used + if (!m_GeoidFile.empty()) + { + sensorModel->SetGeoidFile(m_GeoidFile); + } } else if (m_AverageElevation != -32768.0) { sensorModel->SetAverageElevation(m_AverageElevation); } - if (!m_GeoidFile.empty()) - { - sensorModel->SetGeoidFile(m_GeoidFile); - } - m_OutputTransform = sensorModel.GetPointer(); outputTransformIsSensor = true; otbMsgDevMacro(<< "Output projection set to sensor model"); diff --git a/Code/Projections/otbVectorDataIntoImageProjectionFilter.h b/Code/Projections/otbVectorDataIntoImageProjectionFilter.h index 67e77e1492aeb84b5b47be79139c04e4b9e46dcb..fb95aa27773efe5c0d7375ce5e78a07113b52dc1 100644 --- a/Code/Projections/otbVectorDataIntoImageProjectionFilter.h +++ b/Code/Projections/otbVectorDataIntoImageProjectionFilter.h @@ -76,6 +76,9 @@ public: itkSetStringMacro(GeoidFile); itkGetStringMacro(GeoidFile); + itkSetMacro(AverageElevation, double); + itkGetMacro(AverageElevation, double); + void SetInputVectorData(InputVectorDataPointer input) { this->SetInput(input); @@ -123,6 +126,7 @@ private: std::string m_DEMDirectory; std::string m_GeoidFile; + double m_AverageElevation; ImagePointerType m_InputImage; diff --git a/Code/Projections/otbVectorDataIntoImageProjectionFilter.txx b/Code/Projections/otbVectorDataIntoImageProjectionFilter.txx index 8d760c62bb1e961a0402a6111d704b3c6ba73761..b9487d139e848e91ff56fd98cc3c719e209b12c8 100644 --- a/Code/Projections/otbVectorDataIntoImageProjectionFilter.txx +++ b/Code/Projections/otbVectorDataIntoImageProjectionFilter.txx @@ -183,12 +183,14 @@ VectorDataIntoImageProjectionFilter<TInputVectorData, TInputImage> if (!m_DEMDirectory.empty()) { m_VdExtractFilter->SetDEMDirectory(m_DEMDirectory); - } - + + // Set the geoid file if dem is available if (!m_GeoidFile.empty()) - { - m_VdExtractFilter->SetGeoidFile(m_GeoidFile); + { + m_VdExtractFilter->SetGeoidFile(m_GeoidFile); + } } + // Reproject VectorData in image projection m_VdProjFilter->SetInputProjectionRef(this->GetInput()->GetProjectionRef());