Missing feature in DEMHandler
TL;DR: Provide DEMHandler::GetGeoidHeight()
Rationale
DEMHandler::GetHeightAboveEllipsoid()
has a convoluted behaviour. Depending on what is visible it would return:
-
either geoid offset + DEM offset
-
or DEM offset -- almost equivalent to
GetHeightAboveMSL()
-
or default height above ellipsoid
-
or geoid offset Sometimes we only need the geoid offset (it's the case of DiapOTB SARDEMProjection application).
We could make sure to have no DEM information configured, but then the application can not be chained into memory with another application that will need DEM information. Indeed DEMHandler
is still mostly used as a global object (a singleton) (which is another known issue #2093 (closed)), which makes it impossible to simultaneously have and not have DEM information.
Even if we don't chain such applications in-memory, we must not forget to clear DEM configuration if the applications are used through Python API and not isolated in different subprocesses. Indeed the memory would be shared between the various application object, and as such all the singletons...
As a workaround, SARDEMprojection detects $OTB_GEOID_FILE
value to directly read geoid data from that file, and it falls back to DEMHandler::GetHeightAboveEllipsoid()
if it's not possible. It's much too easy to use incorrectly.
That's why it'd be better to provide a dedicated DEMHandler::GetGeoidHeight()
that would simplify applications such as SARDEMProjection, and that would avoid troubles regarding whether we configure DEM information or not in the global DEMHandler
.