Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for Qt

Explore scenes in flyover AR

Sample Viewer View Sample on GitHub

Use augmented reality (AR) to quickly explore a scene more naturally than you could with a touch or mouse interface.

Use case

You can use AR to drop into an area and visualize information, like a proposed development or a historical model of a city. You could use flyover AR to explore a city by walking through it virtually.

How to use the sample

When you open the sample, you'll be viewing the scene from above. You can walk around, using your device as a window into the scene. Try moving vertically to get closer to the ground.

How it works

  1. Create the ArcGISARView and add it to the view.
  2. Create the scene, add content, then display it.
  3. When the content you want to view loads, get its center point and use that to create the origin camera for the AR view. Note that the altitude should be set so that all scene content is visible. For a city, a good value might be a bit higher than the tallest building. The sample uses 250 meters in the absence of tall buildings in the sample data.
  4. Set the translation factor so that you can move through the scene easily. With a translation factor of 1000, you will move 1000 feet in the scene for every foot you move the physical device.
  5. Set the space effect to Enums.SpaceEffectStars and atmosphere effect to Enums.AtmosphereEffectRealistic to create an immersive experience.

Relevant API

  • ArcGISARView
  • SceneView

About the data

This sample uses a sample integrated mesh layer provided by Vricon. The integrated mesh layer shows an area around the US-Mexico border.

The world elevation service is used to show terrain while the integrated mesh layer loads.

Additional information

  1. Clone the ArcGIS Runtime Toolkit repository.
  2. In the project's .pro file, make sure to set the path, AR_TOOLKIT_SOURCE_PATH, to the ArcGIS Toolkit source folder you just cloned.
  3. The sample contains the necessary changes to deploy to iOS or Android as is.

For more information on the Augmented Reality (AR) toolkit see the AR README on GitHub.

Tags

augmented reality, bird's eye, birds-eye-view, fly over, flyover, mixed reality, translation factor

Sample Code

import QtQuick 2.6
import QtQuick.Controls 2.12
import Esri.ArcGISRuntime 100.9
import Esri.ArcGISExtras 1.1
import Esri.ArcGISArToolkit 1.0

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    ArcGISArView {
        id: arcGISArView
        anchors.fill: parent
        tracking: true
        sceneView: sceneView
    }

    SceneView {
        id: sceneView
        anchors.fill: parent

        Scene {
            id: scene
            BasemapImagery {}

            Surface {
                opacity: 0.0
                ArcGISTiledElevationSource {
                    url: "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
                }
            }

            // create the integrated mesh layer
            IntegratedMeshLayer {
                id: integratedMeshLayer
                url: "https://www.arcgis.com/home/item.html?id=dbc72b3ebb024c848d89a42fe6387a1b"

                onLoadStatusChanged: {
                    if (loadStatus !== Enums.LoadStatusLoaded)
                        return;

                    // Enable subsurface navigation. This allows you to look at the scene from below.
                    sceneView.scene.baseSurface.navigationConstraint = Enums.NavigationConstraintStayAbove;
                    scene.baseSurface.opacity = 1.0;

                    // Start with the camera at the center of the mesh layer.
                    const viewPoint = ArcGISRuntimeEnvironment.createObject("Point", {
                                                                                y: integratedMeshLayer.fullExtent.center.y,
                                                                                x: integratedMeshLayer.fullExtent.center.x,
                                                                                z: 250.0
                                                                            });

                    const originCamera = ArcGISRuntimeEnvironment.createObject("Camera", {
                                                                                   location: viewPoint,
                                                                                   heading: 0,
                                                                                   pitch: 90,
                                                                                   roll: 0
                                                                               });

                    arcGISArView.originCamera = originCamera;

                    // Set the translation factor to enable rapid movement through the scene.
                    arcGISArView.translationFactor = 1000;

                    // Enable atmosphere and space effects for a more immersive experience.
                    sceneView.spaceEffect = Enums.SpaceEffectStars;
                    sceneView.atmosphereEffect = Enums.AtmosphereEffectRealistic;
                }

                onErrorChanged: {
                    console.log("(%1)[%2] %3 - %4".arg(error.code).arg(error.domain).arg(error.message).arg(error.additionalMessage));
                }
            }
        }
    }
}