Introduction

LuciadCPillar allows you to add elevation data to the map. Elevation data usually expresses the height Above Mean Sea Level (AMSL) of the terrain. This article explains how you can load and visualize elevation data.

Decoding elevation data formats

Decoding DTED

You can decode Digital Terrain Elevation Data (DMED) data using the DtedModelDecoderDtedModelDecoderDtedModelDecoder class.

See the related DTED article for more information.

Decoding GeoPackage

You can decode GeoPackage elevation data using the GeoPackageModelDecoderGeoPackageModelDecoderGeoPackageModelDecoder class. Elevation data in the GeoPackage format must be structured as a quad tree.

For the best visualization performance in LuciadCPillar, we recommend that you use tiled elevation data.

See the related GeoPackage article for more information on how to decode GeoPackage data.

Decoding GeoTIFF

The GdalModelDecoderGdalModelDecoderGdalModelDecoder class supports GeoTIFF data with elevation. Single band data using either 32-bit float or 16-bit integer data is considered elevation data.

See the related GeoTIFF article for more information on how to decode GeoTIFF data.

Elevation GeoTIFF using unsigned 16-bit integer data

GeoTIFF elevation data using unsigned 16-bit integers are supported under the following conditions:

  • The dataset contains information about the raster unit type, either internally via the "Unit Type" tag or externally via an auxiliary metadata file, to indicate that raster data should be interpreted as elevation data.

  • The raster unit type is either "m" for an elevation model in meters, "ft" for feet or "us-ft" for US survey feet.

Gdal utility program gdal_edit.py can be used to assign the unit type to a raster dataset:

Assign unit type tag 'm' to the GeoTIFF.
gdal_edit.py -units m dataset.tif

Alternatively, the unit type can be saved into an external .aux.xml file:

Save the unit type 'm' into an external .aux.xml file.
gdal_edit.py -ro -units m dataset.tif

Auxiliary files can also be written manually. A basic example of an auxiliary file containing information about the raster unit type is the following:

Auxiliary file example.
<PAMDataset>
  <PAMRasterBand band="1">
    <UnitType>m</UnitType>
  </PAMRasterBand>
</PAMDataset>

Please note that auxiliary metadata files must have the same name as the GeoTIFF files, but the extension .aux.xml appended, and they must be in the same folder.

In addition to the unit type, it is possible to assign an unsigned 16-bit integer elevation raster a "Scale" and an "Offset".

Auxiliary file with a scale and an offset.
<PAMDataset>
  <PAMRasterBand band="1">
    <UnitType>m</UnitType>
    <Offset>-100.0</Offset>
    <Scale>0.1</Scale>
  </PAMRasterBand>
</PAMDataset>

These values can be used, for example, to store elevations in unsigned 16-bit integers bands with a precision of 0.1 and starting from -100. True values are calculated as:

Units value = offset + (raw value * scale)

Custom elevation data

You can create a custom raster model that contains elevation data. See related article for more information on how to create a custom raster model.

Visualizing elevation

In 3D, the map picks up all elevation datasets that you add to it, and uses them to generate terrain: it deforms the surface of the globe according to that elevation data. During this process, LuciadCPillar takes the layer visibility and order into account:

  • It doesn’t include data from invisible layers in the terrain

  • It generates the terrain from the layers in reverse order: layers that you added at a higher index in the layer list take precedence over layers with a lower index.

If the model has multiple levels with a different level of detail, LuciadCPillar uses less or more detailed data depending on how close the camera is to the terrain. If no data is available at a location, LuciadCPillar generates terrain at elevation 0.

In 2D, the map doesn’t visualize the elevation data.

Other products, such as LuciadLightspeed, sometimes visualize elevation data in 2D using a color map. LuciadCPillar currently doesn’t support this.

Querying elevation data

You can retrieve elevation data from a model using the RasterModelHeightProviderRasterModelHeightProviderRasterModelHeightProvider class. See related article for more information.