text
stringlengths
0
8.81k
rejectOnTileFail
boolean
false
optional
If true, for a failed terrain tile request the promise will be rejected. If false, returned heights will be undefined.
Returns:
A promise that resolves to the provided list of positions when terrain the query has completed.
Example:
// Query the terrain height of two Cartographic positions
const terrainProvider = await Cesium.createWorldTerrainAsync();
const positions = [
Cesium.Cartographic.fromDegrees(86.925145, 27.988257),
Cesium.Cartographic.fromDegrees(87.0, 28.0)
];
const updatedPositions = await Cesium.sampleTerrain(terrainProvider, 11, positions);
// positions[0].height and positions[1].height have been updated.
// updatedPositions is just a reference to positions.
// To handle tile errors, pass true for the rejectOnTileFail parameter.
try {
const updatedPositions = await Cesium.sampleTerrain(terrainProvider, 11, positions, true);
} catch (error) {
// A tile request error occurred.
}
See:
sampleTerrainMostDetailed
sampleTerrainMostDetailed(terrainProvider, positions, rejectOnTileFail) → Promise.<Array.<Cartographic>>
engine/Source/Core/sampleTerrainMostDetailed.js 8
Initiates a sampleTerrain() request at the maximum available tile level for a terrain dataset.
Name
Type
Default
Description
terrainProvider
TerrainProvider
The terrain provider from which to query heights.
positions
Array.<Cartographic>
The positions to update with terrain heights.