Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for Qt

Display a scene

Sample Viewer View Sample on GitHub

Display a scene with a terrain surface and some imagery.

Use case

Scene views are 3D representations of real-world areas and objects. Scene views are helpful for visualizing complex datasets where 3D relationships, topography, and elevation of elements are important factors.

How to use the sample

When loaded, the sample will display a scene. Pan and zoom to explore the scene.

How it works

  1. Create a Scene object with the BasemapImagery basemap.
  2. Create an ArcGISTiledElevationSource object and add it to the scene's base surface.
  3. Create a SceneView object to display the map.
  4. Set the scene to the scene view.

Relevant API

  • Scene
  • ArcGISTiledElevationSource
  • SceneView

Tags

3D, basemap, elevation, scene, surface

Sample Code

import QtQuick 2.6
import QtQuick.Controls 2.2
import Esri.ArcGISRuntime 100.9

Rectangle {
    width: 800
    height: 600

    //! [create the scene with a basemap and surface]
    // Create a scene view
    SceneView {
        anchors.fill: parent

        // create a scene...scene is a default property of sceneview
        // and thus will get added to the sceneview
        Scene {
            // add a basemap
            BasemapImagery {}

            // add a surface...surface is a default property of scene
            Surface {
                // add an arcgis tiled elevation source...elevation source is a default property of surface
                ArcGISTiledElevationSource {
                    url: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
                }
            }
        }

        Component.onCompleted: {
            // set viewpoint to the specified camera
            setViewpointCameraAndWait(camera);
        }
    }
    //! [create the scene with a basemap and surface]

    //! [create the camera to be used as the scene view's viewpoint]
    Camera {
        id: camera
        heading: 10.0
        pitch: 80.0
        roll: 0.0

        Point {
            x: 83.9
            y: 28.4
            z: 10010.0
            spatialReference: SpatialReference { wkid: 4326 }
        }
    }
    //! [create the camera to be used as the scene view's viewpoint]
}