The GetGroundHeight method retrieves the height of a given coordinate on the terrain using the given accuracy level.
HRESULT GetGroundHeight(
[in] double X,
[in] double Y,
[in] AccuracyLevel Level,
[out, retval] double* TerrainHeight)
Parameters:
X – The West-East coordinate of the point of interest represented in MPT units. You can use the other ITerrain properties to retrieve information about the MPT units.
Y – The North-South coordinate of the point of interest represented in MPT units. You can use the other ITerrain properties to retrieve information about the MPT units.
Level – Defines the level of accuracy that you need for the retrieved elevation at the given coordinate. There are three levels possible from the least accurate (but fastest performance-wise) to the most accurate (but slowest performance-wise). The following are the three possible values:
ACCURACY_BEST_FROM_MPT = 2
This is the slowest method, but it retrieves the most accurate
information. Using this flag can create a large performance hit
especially if the terrain information is streamed via an Internet
connection.
ACCURACY_BEST_FROM_MEMORY = 1
This flag tries to get the best information it has about the given
coordinate elevation without reading it directly from the MPT
(based on what TerraExplorer already has in memory). It is faster
than the previous flag but does not guarantee the most accurate
value.
ACCURACY_ NORMAL = 0
With this flag, the client gets the best performance. However, its
returned information about the elevation at that point is the least
accurate.
TerrainHeight – When the method call returns, this parameter contains the height of the terrain at the given coordinate.
Return Values:
The return value obtained from the returned HRESULT can be one of the following:
Return value |
Meaning |
S_OK |
Success. |
E_FAIL |
Catastrophic failure. |
TE_E_MPTNOTLOADED |
An MPT file must be loaded in TerraExplorer for this method to work. |
Remarks:
The retrieved TerrainHeight is based on the information that was written in the MPT. This means that if the MPT was not built with correct height information, this method will also not work properly.