STK ObjectsSend comments on this topic.
GetAltitudeBatch Method (IAgCentralBodyTerrainCollectionElement)
See Also
LatLons
AltRef
Windows





Windows & Linux

Description

Returns the altitudes at the specified position array relative to the input reference surface. If a specified position is outside terrain sources, the altitude of 0.0 relative to the default reference ellipsoid (WGS84 for Earth) is used.

Syntax

[Visual Basic .NET]
Public Function GetAltitudeBatch( _
    ByVal LatLons As System.Array, _
    ByVal AltRef As AgEAltRefType _
) As System.Array
[C#]
public System.Array GetAltitudeBatch(
    System.Array LatLons,
    AgEAltRefType AltRef
);
[Managed C++]
public: System::Array GetAltitudeBatch(
    System::Array ^ LatLons,
    AgEAltRefType AltRef
);
[Unmanaged C++]
public: HRESULT GetAltitudeBatch(
    SAFEARRAY * * LatLons,
    AgEAltRefType AltRef,
    SAFEARRAY * * ppRetVal
);
[Java]
public AgSafeArray getAltitudeBatch(
    AgSafeArray LatLons,
    AgEAltRefType AltRef
);
[Python - STK API ]
def GetAltitudeBatch(self, LatLons:list, AltRef:"AgEAltRefType") -> list:

Parameters

LatLons
AltRef

See Also

Example

Gets the altitude of the terrain at a single location and in batches.
[C#]
IAgScenario scenario = (IAgScenario)root.CurrentScenario;

// If you haven't done so, add the terrain to your scenario (for example .PDTT)
IAgCentralBodyTerrainCollectionElement earthTerrain = scenario.Terrain["Earth"];
earthTerrain.TerrainCollection.Add(terrainFile, AgETerrainFileType.ePDTTTerrainFile);

// Get single altitude
double altitude = earthTerrain.GetAltitude(latitude, longitude, AgEAltRefType.eMSL);

// Get points in batches.
Array specifiedPositions = new object[,]
{
    { 40.0386, -75.5966 },
    { 28.5383, -81.3792 },
    { 37.7749, -122.4194 }
};

Array altitudes = earthTerrain.GetAltitudeBatch(ref specifiedPositions, AgEAltRefType.eWGS84);

// GetAltitudeBatch returns a one-dimensional array of altitude values in the distance unit perference.
int numPoints = altitudes.GetLength(0);
for (int i = 0; i < numPoints; ++i)
{
    Console.WriteLine("Latitude={0}, Longitude={1}, Altitude={2}", specifiedPositions.GetValue(i, 0), specifiedPositions.GetValue(i, 1), altitudes.GetValue(i));
}
Gets the altitude of the terrain at a single location and in batches.
[Visual Basic .NET]
Dim scenario As IAgScenario = DirectCast(root.CurrentScenario, IAgScenario)

' If you haven't done so, add the terrain to your scenario (for example .PDTT)
Dim earthTerrain As IAgCentralBodyTerrainCollectionElement = scenario.Terrain("Earth")
earthTerrain.TerrainCollection.Add(terrainFile, AgETerrainFileType.ePDTTTerrainFile)

' Get single altitude
Dim altitude As Double = earthTerrain.GetAltitude(latitude, longitude, AgEAltRefType.eMSL)

' Get points in batches.
Dim specifiedPositions As Array = New Object(,) {{40.0386, -75.5966}, {28.5383, -81.3792}, {37.7749, -122.4194}}

Dim altitudes As Array = earthTerrain.GetAltitudeBatch(specifiedPositions, AgEAltRefType.eWGS84)

' GetAltitudeBatch returns a one-dimensional array of altitude values in the distance unit perference.
Dim numPoints As Integer = altitudes.GetLength(0)
Dim i As Integer = 0
While i < numPoints
	Console.WriteLine("Latitude={0}, Longitude={1}, Altitude={2}", specifiedPositions.GetValue(i, 0), specifiedPositions.GetValue(i, 1), altitudes.GetValue(i))
	System.Threading.Interlocked.Increment(i)
End While
© 2024 Analytical Graphics, Inc. All Rights Reserved.