The GetGroundHeightEx method retrieves Information about a given coordinate on the terrain, using the given accuracy level. If there is an object, derived from ITerrainObject5 with the ITerrainObject5::GroundObject property set to TRUE, at the selected coordinate and the IncludeGroundObject parameter is set to TRUE, the method returns the ObjectID of the object, and its height at the coordinate.
Implemented only in ITerrain3.
HRESULT GetGroundHeightEx(
[in] double X,
[in] double Y,
[in] AccuracyLevel Level,
[in] bool IncludeGroundObject,
[out] VARIANT* bstrObjectID,
[out] VARIANT* doubleTerrainHeight)
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_NORMAL = 0
With this flag, the client gets the best performance. However, the
returned information about the elevation at the selected point is
the least accurate.
ACCURACY_BEST_FROM_MEMORY = 1
This flag tries to get the best possible information for the
elevation at the selected point, without reading it directly from
the MPT (i.e., based on the data already in TerraExplorer memory).
It is faster than the previous flag but does not guarantee the most
accurate value.
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.
IncludeGroundObject – A Boolean that determines whether the method includes Ground Objects in the result, when set to TRUE, or ignores them and returns the ground alone, when set to FALSE.
bstrObjectID – If an object is in the given coordinate, this returns the ID of the object
doubleTerrainHeight – When the method call returns, this parameter contains the height of the terrain at the given coordinate. If an On Ground Object exists at the point and the IncludeGroundObjects parameter is set to TRUE, this returns the height of the object 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. |