You will learn: how to build an app to load and display a 3D web scene from ArcGIS Online.
Applications can load and display 3D
In this tutorial, you will build an app that loads and displays a pre-configured web scene stored in
Go to the LA Trails and Parks Scene to view the scene in the Scene Viewer. Make note of the ID at the end of the URL.
Start Qt Creator.
Choose the ArcGIS Runtime Qt Quick C++ project template.
Give your app a name. For this tutorial we chose display_a_web_scene, but you can choose any name that suits you. Click Next.
On the Define Project Details dialog, click the checkbox 3D project. Leave all the other settings as they are and click Continue.
On the Kit Selection dialog, choose one of the kits you previously setup when you installed the Qt Framework. Click Next.
Verify your selections and click Done.
In Projects, double click on Sources > display_a_web_scene.cpp and comment out the two include statements as shown next. The elevation source and basemap do not need to be configured in the code; they are defined in the web scene itself.
// *** UPDATE ** // #include "ArcGISTiledElevationSource.h" // #include "Basemap.h"
Comment out the code that creates a new Scene from a basemap in the initializer list.
// *** UPDATE *** // QObject(parent), // m_scene(new Scene(Basemap::topographic(this), this))
Comment out the existing code in the constructor body. This app will not use an elevation source, but instead the elevation source is configured with the portal item (a web scene).
// *** UPDATE *** // ArcGISTiledElevationSource* elevationSource = new ArcGISTiledElevationSource( // QUrl("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"), this); // m_scene->baseSurface()->elevationSources()->append(elevationSource);
Add the following code to the constructor body to create
m_scene from a portal item. The portal item is constructed using a URL and a portal item ID (scene_id below).
// *** ADD *** const QString scene_id("579f97b2f3b94d4a8e48a5f140a6639b"); const QUrl websceneUrl(QString("https://arcgis.com/sharing/rest/content/items/" + scene_id)); m_scene = new Scene(websceneUrl, this);
Run your app to test your code. When the app opens, you should see some trails of Los Angeles displayed in a scene.
Compare your scene with our completed solution project.
ArcGIS Online contains thousands of public web maps and scenes that can be loaded by applications. Go to
Add a control that allows the user to select from a list of available web scenes when the app is running. Display the selected web scene in your app.