Learn how to use Scene Viewer to create a web scene for your application.
A web scene is a scene that you can create with the Scene Viewer, stored in ArcGIS, and then use in applications. The Scene Viewer allows you to interactively style and configure scenes by setting the basemap layer, elevation layers, data layers, as well as layer visibility ranges. All of the settings are stored as JSON in an item. A number of ArcGIS applications and APIs can access web scene items, read the JSON, and then re-create the original map.
In this tutorial, you use the Scene Viewer to create and save a web scene using hosted feature layers. You will also inspect the JSON that contains the web scene settings.
Prerequisites
This tutorial provides the steps required for developers who have an Location Platform or ArcGIS Online account to create and save web scenes in Scene Viewer.
However, most steps also apply to developers with an ArcGIS Enterprise account.
Steps
Set the basemap layer
To create a web scene with the Scene Viewer, start by setting the basemap layer. Use the Streets vector tile basemap.
-
Open the Scene Viewer and sign in to your ArcGIS account.
-
Click New Scene.
-
In the right panel, click the Basemap icon > Streets.
-
Close the Basemap panel.
Add data layers
To display data in a web scene, add hosted feature layers for trailheads, trails, and parks in the Santa Monica Mountain area.
-
In the left panel, click Add layers > Enter layer URL.
-
For each URL:
- Copy and paste the URL in Layer URL and give the layer a name in Layer name > Add.
- Parks and Open Space:
https:
//services3.arcgis.com/GVgb Jbqm8h XASVYi/ArcGIS/rest/services/Parks_ and_ Open_ Space/Feature Server/0 - Trails:
https:
//services3.arcgis.com/GVgb Jbqm8h XASVYi/arcgis/rest/services/Trails/Feature Server/0 - Trailheads:
https:
//services3.arcgis.com/GVgb Jbqm8h XASVYi/arcgis/rest/services/Trailheads/Feature Server/0
- Parks and Open Space:
- Copy and paste the URL in Layer URL and give the layer a name in Layer name > Add.
-
In the toolbar, use the tools to pan and rotate the scene to drag the map until you can see the horizon.
Save the web scene
After you create a web scene, you can save it. Saving the scene will create a new item and you can access the scene in an application. You can also set the security of the item to the appropriate sharing level if you have an ArcGIS Online account.
-
Click Save Scene. At minimum, you need to provide a title and tags to save the scene > Save.
-
Optionally, set the sharing level of the scene in the item page.
Your web scene should look something like this.
View web scene JSON
A web scene item contains JSON that defines the scene properties. The structure of the web scene is defined by the Web Scene Specification. Applications can access a web scene item or read the JSON directly to format layers and create a scene, so it's useful to know how to get the JSON for a web scene.
-
In your web browser, find the item ID at the end of the URL for the web scene you just saved.
- For example:
a82026c675804e95be448b300c70bc03
.
- For example:
-
In a new browser tab, copy and paste the following URL and insert your item ID. This will return the JSON for your web scene.
https:
//www.arcgis.com/sharing/rest/content/items/{ your-item-id }/data - For example: https://www.arcgis.com/sharing/rest/content/items/a82026c675804e95be448b300c70bc03/data
-
In the JSON, identify the operational (data) layers and the elevation layer. For example:
Use dark colors for code blocks Copy { "operationalLayers":[ { "id":"164a5a3ade4-layer-2", "title":"Parks and Open Space", "url":"https://services3.arcgis.com/GVgbJbqm8hXASVYi/ArcGIS/rest/services/Parks_and_Open_Space/FeatureServer/0", "layerType":"ArcGISFeatureLayer", "popupInfo":{ "showAttachments":true, "popupElements":[ { "type":"fields" }, { "type":"attachments" } ], "fieldInfos":[ { "fieldName":"UNIT_ID",
Now that you have a web scene, you can choose to style it further in a tutorial. Or, you can load it into a tutorial by accessing it by its item ID.
What's next?
Learn how to use additional tools, APIs, and location services in these tutorials:
Create a web scene
Style layers in a web scene
Display a web scene
Create and display a scene from a web scene.