View on GitHub Sample viewer app

Vertically exaggerate terrain in a scene.

Image of Apply terrain exaggeration

Use case

Vertical exaggeration is useful when the horizontal extent of a landscape is much larger than the vertical relief. Exaggerating elevation makes small terrain variations more visible, which is helpful for visualizations, presentations, and exploratory analysis.

How to use the sample

Open the sample to display a SceneView centered on a location with elevation data. Use the ”+” and ”-” buttons in the bottom sheet to increase or decrease the terrain vertical exaggeration. The UI shows the current exaggeration factor (1x to 10x).

How it works

  1. Create an ArcGISTiledElevationSource that points to a terrain ImageServer.
    1. An elevation source defines the terrain based on a digital elevation model (DEM) or digital terrain model (DTM).
  2. Add the elevation source to a Surface and assign that surface to a Scene’s baseSurface.
  3. Configure the surface’s elevationExaggeration using a multiplier factor.

Relevant API

  • baseSurface
  • elevationExaggeration
  • Scene
  • Surface

Tags

3D, DEM, elevation, exaggeration, scene, surface, terrain

Sample Code

MainActivity.kt MainActivity.kt ApplyTerrainExaggerationViewModel.kt ApplyTerrainExaggerationScreen.kt
/* Copyright 2025 Esri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.esri.arcgismaps.sample.applyterrainexaggeration
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import com.arcgismaps.ApiKey
import com.arcgismaps.ArcGISEnvironment
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme
import com.esri.arcgismaps.sample.applyterrainexaggeration.screens.ApplyTerrainExaggerationScreen
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// authentication with an API key or named user is
// required to access basemaps and other location services
ArcGISEnvironment.apiKey = ApiKey.create(BuildConfig.ACCESS_TOKEN)
setContent {
SampleAppTheme {
ApplyTerrainExaggerationApp()
}
}
}
@Composable
private fun ApplyTerrainExaggerationApp() {
Surface(color = MaterialTheme.colorScheme.background) {
ApplyTerrainExaggerationScreen(
sampleName = getString(R.string.apply_terrain_exaggeration_app_name)
)
}
}
}