Skip to content
Snippets Groups Projects
Commit b526e53a authored by Julien Michel's avatar Julien Michel
Browse files

ENH: Adding an optionnal geoid file, and the possibility to use height above ellispoid

parent 239e32b0
Branches
Tags
No related merge requests found
...@@ -102,12 +102,22 @@ public: ...@@ -102,12 +102,22 @@ public:
itkSetObjectMacro(Transform, GenericRSTransformType); itkSetObjectMacro(Transform, GenericRSTransformType);
itkGetConstObjectMacro(Transform, GenericRSTransformType); itkGetConstObjectMacro(Transform, GenericRSTransformType);
/** Set/Get the above ellipsoid flag. If false, height is given
above MSL */
itkSetMacro(AboveEllipsoid,bool);
itkGetMacro(AboveEllipsoid,bool);
itkBooleanMacro(AboveEllipsoid);
void InstanciateTransform(); void InstanciateTransform();
/** Set the DEM directory. */ /** Set the DEM directory. */
virtual void SetDEMDirectoryPath(const char* DEMDirectory); virtual void SetDEMDirectoryPath(const char* DEMDirectory);
virtual void SetDEMDirectoryPath(const std::string& DEMDirectory); virtual void SetDEMDirectoryPath(const std::string& DEMDirectory);
/** Set the DEM directory. */
virtual void SetGeoidFile(const char* path);
virtual void SetGeoidFile(const std::string& path);
/** /**
* Set/Get input & output projections. * Set/Get input & output projections.
* Set/Get input & output keywordlist * Set/Get input & output keywordlist
...@@ -187,6 +197,7 @@ protected: ...@@ -187,6 +197,7 @@ protected:
SpacingType m_OutputSpacing; SpacingType m_OutputSpacing;
SizeType m_OutputSize; SizeType m_OutputSize;
PixelType m_DefaultUnknownValue; PixelType m_DefaultUnknownValue;
bool m_AboveEllipsoid;
private: private:
DEMToImageGenerator(const Self &); //purposely not implemented DEMToImageGenerator(const Self &); //purposely not implemented
......
...@@ -36,6 +36,7 @@ DEMToImageGenerator<TDEMImage> ...@@ -36,6 +36,7 @@ DEMToImageGenerator<TDEMImage>
m_OutputSize[1] = 1; m_OutputSize[1] = 1;
m_OutputOrigin[0] = 0; m_OutputOrigin[0] = 0;
m_OutputOrigin[1] = 0; m_OutputOrigin[1] = 0;
m_AboveEllipsoid = false;
// Value defined in the norm for points SRTM doesn't have information. // Value defined in the norm for points SRTM doesn't have information.
m_DefaultUnknownValue = static_cast<PixelType>(-32768); m_DefaultUnknownValue = static_cast<PixelType>(-32768);
...@@ -59,6 +60,22 @@ SetDEMDirectoryPath(const std::string& DEMDirectory) ...@@ -59,6 +60,22 @@ SetDEMDirectoryPath(const std::string& DEMDirectory)
this->SetDEMDirectoryPath(DEMDirectory.c_str()); this->SetDEMDirectoryPath(DEMDirectory.c_str());
} }
template<class TDEMImage>
void
DEMToImageGenerator<TDEMImage>::
SetGeoidFile(const char* path)
{
m_DEMHandler->OpenGeoidFile(path);
}
template<class TDEMImage>
void
DEMToImageGenerator<TDEMImage>::
SetGeoidFile(const std::string& path)
{
this->SetGeoidFile(path.c_str());
}
// GenerateOutputInformation method // GenerateOutputInformation method
template <class TDEMImage> template <class TDEMImage>
void DEMToImageGenerator<TDEMImage> void DEMToImageGenerator<TDEMImage>
...@@ -146,11 +163,29 @@ DEMToImageGenerator<TDEMImage> ...@@ -146,11 +163,29 @@ DEMToImageGenerator<TDEMImage>
if(m_Transform.IsNotNull()) if(m_Transform.IsNotNull())
{ {
geoPoint = m_Transform->TransformPoint(phyPoint); geoPoint = m_Transform->TransformPoint(phyPoint);
height = m_DEMHandler->GetHeightAboveMSL(geoPoint); // Altitude calculation if(m_AboveEllipsoid)
{
height = m_DEMHandler->GetHeightAboveEllipsoid(geoPoint); // Altitude
// calculation
}
else
{
height = m_DEMHandler->GetHeightAboveMSL(geoPoint); // Altitude
// calculation
}
} }
else else
{ {
height = m_DEMHandler->GetHeightAboveMSL(phyPoint); // Altitude calculation if(m_AboveEllipsoid)
{
height = m_DEMHandler->GetHeightAboveEllipsoid(phyPoint); // Altitude
// calculation
}
else
{
height = m_DEMHandler->GetHeightAboveMSL(phyPoint); // Altitude
// calculation
}
} }
/* otbMsgDevMacro(<< "Index : (" << currentindex[0]<< "," << currentindex[1] << ") -> PhyPoint : (" /* otbMsgDevMacro(<< "Index : (" << currentindex[0]<< "," << currentindex[1] << ") -> PhyPoint : ("
<< phyPoint[0] << "," << phyPoint[1] << ") -> GeoPoint: (" << phyPoint[0] << "," << phyPoint[1] << ") -> GeoPoint: ("
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment