View on GitHub Sample viewer app

Add a scene layer to a scene.

Image of scene layer

Use case

Each scene layer added to a scene can assist in performing helpful visual analysis. For example, if presenting the results of a shadow analysis of a major metropolitan downtown area in 3D, adding a scene layer of 3D buildings to the scene that could be toggled on/off would help to better contextualize the source of the shadows.

How to use the sample

When launched, this sample displays a scene service with an ArcGISSceneLayer. Pan and zoom to explore the scene.

How it works

  1. Create an ArcGISScene and set its Basemap with ArcGISScene.setBasemap().
  2. Create a SceneView and set the scene to the view with sceneView.setScene(scene).
  3. Create an ArcGISSceneLayer using a data source URI: new ArcGISSceneLayer(Uri).
  4. Add the new scene layer to the scene as an operational layer with ArcGISScene.getOperationalLayers().add(sceneLayer).

About the data

The scene shows a buildings layer in Brest, France hosted on ArcGIS Online.

Relevant API

  • ArcGISScene
  • ArcGISSceneLayer
  • SceneView

Tags

3D, layer, scene

Sample Code

module-info.java module-info.java SceneLayerSample.java
/*
* Copyright 2022 Esri.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module com.esri.samples.scene_layer {
// require ArcGIS Maps SDK for Java module
requires com.esri.arcgisruntime;
// handle SLF4J http://www.slf4j.org/codes.html#StaticLoggerBinder
requires org.slf4j.nop;
// require JavaFX modules that the application uses
requires javafx.graphics;
exports com.esri.samples.scene_layer;
}