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
No related branches found
No related tags found
No related merge requests found
......@@ -102,12 +102,22 @@ public:
itkSetObjectMacro(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();
/** Set the DEM directory. */
virtual void SetDEMDirectoryPath(const char* 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 keywordlist
......@@ -187,6 +197,7 @@ protected:
SpacingType m_OutputSpacing;
SizeType m_OutputSize;
PixelType m_DefaultUnknownValue;
bool m_AboveEllipsoid;
private:
DEMToImageGenerator(const Self &); //purposely not implemented
......
......@@ -36,6 +36,7 @@ DEMToImageGenerator<TDEMImage>
m_OutputSize[1] = 1;
m_OutputOrigin[0] = 0;
m_OutputOrigin[1] = 0;
m_AboveEllipsoid = false;
// Value defined in the norm for points SRTM doesn't have information.
m_DefaultUnknownValue = static_cast<PixelType>(-32768);
......@@ -59,6 +60,22 @@ SetDEMDirectoryPath(const std::string& DEMDirectory)
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
template <class TDEMImage>
void DEMToImageGenerator<TDEMImage>
......@@ -146,11 +163,29 @@ DEMToImageGenerator<TDEMImage>
if(m_Transform.IsNotNull())
{
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
{
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 : ("
<< phyPoint[0] << "," << phyPoint[1] << ") -> GeoPoint: ("
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment