Display a scene

Scenes are the fundamental document for sharing and storing collections of 3D geographic data, analogous to the 2D map. Scenes are supported across the ArcGIS platform, including ArcGIS Online and Portal. This document explains how to display a scene stored in ArcGIS Online or Portal.

Open from Portal item

You can open a scene directly from an ArcGIS Portal item or from ArcGIS Online (which can be thought of as a cloud-hosted Portal).

//initialize portal with AGOL
portal = AGSPortal.arcGISOnline(withLoginRequired: false)
//get the portal item
let portalItem = AGSPortalItem.init(portal: portal, itemID: "a13c3c3540144967bc933cb5e498b8e4")
//create scene from portal item
let scene = AGSScene(item: portalItem)

Open from URL

You can open a scene directly from a URL in one of the following formats:

  • Scene viewer URL - https://www.arcgis.com/home/webscene/viewer.html?webscene=a13c3c3540144967bc933cb5e498b8e4
  • Item URL - https://www.arcgis.com/home/item.html?id=a13c3c3540144967bc933cb5e498b8e4
  • Item data URL - https://www.arcgis.com/sharing/rest/content/items/a13c3c3540144967bc933cb5e498b8e4/data

//create scene from the URL
let scene = AGSScene(url: URL(string: "https://www.arcgis.com/home/item.html?id=a13c3c3540144967bc933cb5e498b8e4")!)

Display in a SceneView

Once you've opened a scene from a URL or a portal item, you can display it using a SceneView. The view provides services to display the scene, enable selection, present overlay graphics, and navigate using one of several camera controllers.

sceneView.scene = scene

Monitor scene drawing

Whenever the view into your scene changes, the scene needs to be redrawn. This happens whenever the user pans or zooms, a camera controller updates the camera, or any other event occurs that requires the scene view to redraw the scene.

You can add an observer on the SceneView to detect when the drawStatus has changed.

//add observer for drawStatus on sceneView
sceneView.addObserver(self, forKeyPath: "drawStatus", options: .new, context: nil)


override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {      
 if self.sceneView.drawStatus == AGSDrawStatus.inProgress {           

Navigate the scene

The scene defines the initial viewpoint. Users can then navigate the scene using mouse or keyboard as available. See Navigate a scene view to learn about the various interaction options and how to programmatically navigate the scene.

Configure the SceneView

There are two important concepts to consider when configuring a scene view:

  • Camera controllers - define how navigation works in the scene.
  • Atmosphere effect - defines how the sky looks.

To learn about camera controllers, see Follow a graphic in a scene view.

There are three effect options:

  • None - There is no atmosphere effect; anything that isn't a part of the scene is rendered black with a starfield consisting of randomly placed white dots.
  • Realistic - There is an atmosphere effect applied to both the sky and the surface as viewed from above.
  • Horizon only - There is an atmosphere effect applied to the sky (horizon) only.

You can apply any of these options to the scene view's AtmosphereEffect property.

Visualization of the scene atmosphere effect options, showing both zoomed in scenes and scenes as viewed from space

Filter data by time

Some layer types are time-aware, meaning they contain data that can be filtered by time values. Runtime has rich support for time-aware layers and data. See Visualize and compare data over time to learn more.