###Exercise 5, Add a Scene Layer to a 3D map
This lab covers the basics of adding a scene layer to your application.
To learn more about what options you have with SceneLayers look at the SceneLayer API Reference
-
Click create_starter_map_3d/index.html and copy the contents to a new jsbin.com.
-
In
JSBin
>HTML
, update therequire
statement andfunction
definition:
require([
"esri/Map",
"esri/views/SceneView",
"esri/layers/SceneLayer",
"dojo/domReady!"
], function(Map, SceneView, SceneLayer) {
- Now let's add the buildings scene layer to the map:
var buildingsSL = new SceneLayer({
url: "https://tiles.arcgis.com/tiles/0p6i4J6xhQas4Unf/arcgis/rest/services/New_York_City_3D_Buildings_Optimized/SceneServer"
});
var map = new Map({
basemap: "dark-gray-vector",
ground: "world-elevation",
layers: [buildingsSL]
});
-
The JSBin
Output
panel should show a 3D view of earth that you can rotate around and zoom in on Manhatten to see the 3D buildings. -
Since we are focused on New York City, modify the SceneView to be zoomed in more and tilt the scene since we are looking at 3D data. Take a look at the SceneView and the Camera
var view = new SceneView({
container: "viewDiv",
map: map,
camera:{
position: [-74.022468, 40.699343, 790],
tilt: 71.47,
heading: 30.25
}
});
Your app should look something like this:
###Bonus
- Add the same layers you did in the 2D map, MetroLines, BlockGroups, and MetroStations You can see the resulting code here