sampleHeightMostDetailed

suspend fun sampleHeightMostDetailed(positions: ReadonlyArray<Cartographic>, objectsToExclude: ReadonlyArray<Any>? = definedExternally, width: Double? = definedExternally): ReadonlyArray<Cartographic>(source)

Initiates an asynchronous Scene.sampleHeight query for an array of Cartographic positions using the maximum level of detail for 3D Tilesets in the scene. The height of the input positions is ignored. Returns a promise that is resolved when the query completes. Each point height is modified in place. If a height cannot be determined because no geometry can be sampled at that location, or another error occurs, the height is set to undefined.

const positions = [
new Cartographic(-1.31968, 0.69887),
new Cartographic(-1.10489, 0.83923)
];
const promise = viewer.scene.sampleHeightMostDetailed(positions);
promise.then(function(updatedPosition) {
// positions[0].height and positions[1].height have been updated.
// updatedPositions is just a reference to positions.
}

Return

A promise that resolves to the provided list of positions when the query has completed.

Parameters

positions

The cartographic positions to update with sampled heights.

objectsToExclude

A list of primitives, entities, or 3D Tiles features to not sample height from.

width

Width of the intersection volume in meters. Default value - 0.1

See also