Display a scene

Add 3D visualization to your app to view data in its near real-world perspective. To add 3D visualization, assign a scene to a scene view, similar to the way you assign a map to a map view for 2D visualization. A scene view, like its 2D equivalent, the map view, gives you the ability to zoom and pan around the scene.

The data you visualize in your 3D app is defined by the scene class. The types of data you can display in a scene include:

  • Basemaps, which can be draped over surface layers. A surface layer contains elevation information. Other layer types can also be used as a basemap, including ArcGIS and Open Geographic Consortium (OGC) layers like WMS.
  • Operational layers, which can include feature layers or scene layers. Scene layers represent built and natural 3D content such as buildings, trees, valleys, and mountains and can be accessed as scene services or local scene layer packages.
  • Surface layers, which define the elevation information of the 3D visualization. A surface layer can come in many forms, for example, local raster data such as a DEM or DTED or from an ArcGIS image service.

Display a scene using a scene service

  1. Declare a SceneView.

    SceneView {
        id: mySceneView
        objectName: "sceneView"
        anchors.fill: parent
    }

  2. Create a Scene. You can do this by declaring it inside the SceneView that will use it, or you can declare them separately, and later in a function, assign the Scene to the SceneView (as in this example).

    Scene {
        id: cityScene
        BasemapTopographic {}
        Surface {
            ArcGISTiledElevationSource {
                url: "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
            }
        }
        ArcGISSceneLayer {
            url: "http://scene.arcgis.com/arcgis/rest/services/Hosted/Buildings_Brest/SceneServer/layers/0"
        }
    }
    
    
    Camera {
        id: cityCamera
        location: Point {
            x: -4.48261 // longitude
            y: 48.3983  // latitude
            z: 300.0    // elevation
            spatialReference: SpatialReference.createWgs84()
        }
        heading: 347.0
        pitch: 55.0
        roll: 0.0
    }
    
    
    function displayCity() {
        console.log("displayCity()");
        mySceneView.scene = cityScene;
        mySceneView.setViewpointCameraAndWait(cityCamera);
    }

  3. You may want to set the camera (set an initial viewing position) or add graphics.

You can see a complete code example in the QML sample Display Scene Layer.

Display a scene using a 3D surface

Add a surface layer to a scene with a basemap for 3D visualization in your app.

  1. Create a Scene, and create a Surface within the Scene.

    Scene {
        id: mountainScene
        BasemapImagery {}
        Surface {
            ArcGISTiledElevationSource {
                url: "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
            }
        }
    }

Set the camera

The position you view the scene from is defined by a camera class. When you create a new camera class, you must define the following properties:

  • 3D location—Latitude, longitude, and elevation
  • Heading—Direction the camera is pointing towards
  • Pitch—Up and down angle of camera

Create a Camera to display the scene from a particular viewpoint.

Create a scene layer package and local elevation source

ArcGIS Pro allows you to create a scene layer package using a geoprocessing tool. You can add this local scene layer package (.slpk) as a scene layer  (ArcGISSceneLayer) to your ArcGIS Runtime app and add it to a Scene.

To take this scene layer offline your app can define an elevation surface by consuming local raster datasets on the client. The following formats are supported for creating a local elevation source:

  • ASRP/USRP
  • CIB1, 5, 10
  • DTED0, 1, 2
  • GeoTIFF
  • HFA
  • HRE
  • IMG
  • JPEG
  • JPEG 2000
  • NITF
  • PNG
  • RPF
  • SRTM1, 2