ArcGIS Runtime SDK for .NET Samples

Terrain exaggeration

Exaggerated scene terrain



// Copyright 2019 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:
// 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.

using System;
using Android.App;
using Android.OS;
using Android.Widget;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.UI.Controls;

namespace ArcGISRuntimeXamarin.Samples.TerrainExaggeration
    [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
        "Terrain exaggeration",
        "Configure the vertical exaggeration of terrain (the ground surface) in a scene.",
        "Elevation", "terrain", "DTM", "DEM", "surface", "3D", "scene")]
    public class TerrainExaggeration : Activity
        // Hold reference to the UI controls.
        private SceneView _mySceneView;
        private SeekBar _terrainSlider;

        private readonly string _elevationServiceUrl = "";

        protected override void OnCreate(Bundle bundle)

            Title = "Terrain exaggeration";


        private void Initialize()
            // Configure the scene with National Geographic basemap.
            _mySceneView.Scene = new Scene(Basemap.CreateNationalGeographic());

            // Add the base surface for elevation data.
            Surface elevationSurface = new Surface();
            ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(new Uri(_elevationServiceUrl));

            // Add the surface to the scene.
            _mySceneView.Scene.BaseSurface = elevationSurface;

            // Set the initial camera.
            MapPoint initialLocation = new MapPoint(-119.9489, 46.7592, 0, SpatialReferences.Wgs84);
            Camera initialCamera = new Camera(initialLocation, 15000, 40, 60, 0);

            // Update terrain exaggeration based on the slider value.
            _terrainSlider.ProgressChanged += (sender, e) =>
                // Values are scaled to enable smoother animation - Android Seekbar has a course step size.
                elevationSurface.ElevationExaggeration = 1 + _terrainSlider.Progress / 20.0;

        private void CreateLayout()
            // Create a new vertical layout for the app.
            var layout = new LinearLayout(this) { Orientation = Orientation.Vertical };

            // Create the views.
            _mySceneView = new SceneView();
            _terrainSlider = new SeekBar(this);
            _terrainSlider.Max = 20;

            TextView terrainLabel = new TextView(this);
            terrainLabel.Text = "Terrain exaggeration:";

            // Add the views to the layout.

            // Show the layout in the app.

In this topic
  1. Code