ArcGIS Runtime SDK for Android

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 guide explains how to display a pre-configured scene stored in ArcGIS Online or Portal. To learn how to create your own scene from code, see Build a new scene. The difference between 2D and 3D map presentation style is described in the topic Maps and scenes.

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 the portal with ArcGIS Online
Portal portal = new Portal("http://www.arcgis.com");


// Get the portal item
PortalItem portalItem = new PortalItem(portal, "a13c3c3540144967bc933cb5e498b8e4");


// Create the scene from the portal item
ArcGISScene scene3d = new ArcGISScene(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
ArcGISScene scene3d = new ArcGISScene("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.

// show the scene in a SceneView 
sceneView = new SceneView();
sceneView.setArcGISScene(scene3d);

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.

// listen for draw status to change
sceneView.addDrawStatusChangedListener((drawStatus) -> {
  drawStatus.getDrawStatus();
});

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

Defining a memory limit

If your Android app needs to display a large number of features or geometry that is very complex, it might improve responsiveness to limit the amount of memory used by the scene view. You can control the amount of total memory used to render scene data by assigning a value (in bytes) with the SceneView.setMemoryLimit static method. You must provide a value for this setting before any SceneView instances are constructed.

If an explicit value isn't set, a default memory limit is determined as follows.

  • If the approximate per-application memory class of the device is greater than 1 GB, that value is used as the limit.
    • Otherwise, if 45% of total system memory is less than 1 GB, that value is used as the memory limit.
      • Otherwise, 1 GB is used as the memory limit.

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.