3D Terrain & RGB Terrain

Fakhriy Ramadhan
3 min readMar 7, 2024

--

The simplification of Earth’s surface topography is represented by contour maps, which have been crucial for various human activities such as navigation, urban planning, mining, and disaster risk assessment. However, interpreting a 2D map of topography can be challenging, especially when visualizing a wide area. Recently, I was introduced to 3D Terrain, a digital twin that represents Earth’s surface topography. The visualization in Image 1 depicts the contours of South Switzerland. Compared to a 2D map, this 3D model helps visualize the intricate details of steep terrain in mountain ranges.

Image 1. 3D Terrain of south section of Switzerland

In practical terms, consider the scenario of a jungle explorer or hiker planning a route. They could assess all potential safe routes for their journey by examining the 3D Terrain. For instance, Image 3 displays the terrain profile of a cycling route. By examining the 3D terrain, users can anticipate the challenges of their chosen route. Detailed terrain charts provide precise information on when and where users will encounter the steepest sections of their journey. This information helps users make decisions on conserving stamina, or for cyclists using hybrid bikes, knowing when to utilize electric boost assistance.

Image 2. Strava Running Terrain Graph

However, how is this 3D terrain produced? What are the input data required for generating it? 3D terrain can be created by visualizing RGB terrain through a code decoder, with Mapbox being one of the most well-known options. The input data consists of RGB Terrain data, which is a type of raster image altered to store altitude information in RGB format. This raster image specifically refers to a Digital Terrain Model (DTM). In Image 3, you can observe the visualization of RGB terrain, characterized by dominant green and blue colors. Upon closer examination of the RGB data, the blue section represents the lowest altitude, while the darker green indicates higher altitude.

Mapbox has officially launched an equation to define height in RGB format. This equation incorporates red, green, blue, baseshift, and a constant. The baseshift refers to the base raster image altitude, with all raster heights being subtracted by 10000 in the equation.

height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1)
Image 3. RGB Terrain example

The final step involves converting from RGB terrain to raster tiling. The concept of raster tiling divides a raster image into smaller, more manageable square pieces called “tiles,” which are then stored using the XYZ concept. Each tile’s location refers to a global grid, with:

  • X representing the tile’s column position from west to east.
  • Y representing the tile’s row position from north to south.
  • Z representing the zoom level.

Higher zoom levels imply the raster is divided into more sections, resulting in more folders and data at higher zoom levels.

Below is the implementation of 3D terrain on imagery satellite and OSM basemap. The label appears more interactive in imagery satellite basemap, details provided by Braga Technologies.

Geodashboard: 3D Terrain

reference:

https://docs.mapbox.com/data/tilesets/reference/mapbox-terrain-rgb-v1/

--

--