There are two ways to retrieve elevation data:

  • You retrieve elevation data from a single model, with the user controlling the level of detail. See this article for more information.

  • You retrieve elevation data from the map using the Map::HeightProviderMap::HeightProviderMap::HeightProvider class. The elevation data sources and the level of detail are computed for you based on what is currently visible on the Map.

The height provider takes as parameters a coordinate in device independent pixels, and a boolean value to specify if you want to apply bilinear interpolation to the height values. The height provider returns an elevation in the unit of measure of the map.

The height provider handles multiple elevation layers by querying the height for each visible layer from top to bottom, and returns the height value from the first layer with a value for the specified pixel coordinate.

If no visible elevation model lies underneath the queried pixel, the height provider doesn’t return any value.

Program: Retrieving elevation from the map at pixel coordinate (0,0)
const Map::HeightProvider& heightProvider = _map->getHeightProvider();
Coordinate centerOfTheScreen{_map->getWidth() / 2.0, _map->getHeight() / 2.0};
std::optional<double> elevation = heightProvider.retrieveHeightAt(centerOfTheScreen, false);
Coordinate centerOfTheScreen = new Coordinate(_map.Width / 2.0, _map.Height / 2.0);
Map.HeightProvider heightProvider = _map.GetHeightProvider();
double? elevation = heightProvider.RetrieveHeightAt(centerOfTheScreen, true);
Coordinate centerOfTheScreen = new Coordinate(_map.getWidth() / 2.0, _map.getHeight() / 2.0);
Map.HeightProvider heightProvider = _map.getHeightProvider();
Double elevation = heightProvider.retrieveHeightAt(centerOfTheScreen, true);