odoe

A New Point of View

Blog Post created by odoe on Dec 2, 2015

esri-sceneview.png

The ArcGIS 4.0 Beta 2 is out and it's another step forward in what you can expect in the next generation of the ArcGIS JavaScript API.

 

I talked about the general updates in this release here and a bit more about Vector Tiles here.

 

So if you haven't been paying attention, a big new feature in the 4.0 version of the API is 3D support. The 4.0 beta doesn't currently support Web Maps,(it will) but it does now support Web Scenes. You can create a Web Scene in the ArcGIS Online SceneViewer. Now you can take those scenes create in the SceneViewer and use them in your 4.0 beta application.

 

Once you have a Scene created, just use the item id like you would use for any ArcGIS Online item and pass it into the WebScene.

 

Here is a demo pretty much just like the Esri sample.

require([
  "esri/views/SceneView",
  "esri/portal/PortalItem",
  "esri/WebScene",
  "dojo/domReady!"
], function(SceneView, PortalItem, WebScene) {
  var scene = new WebScene({
    portalItem: new PortalItem({
      id: "94b0da9f133947089773a681523882e7"
    })
  });
  var view = new SceneView({
    map: scene,
    container: "viewDiv"
  });
});

 

Notice that you technically create a PortalItem with your item id and you pass that PortalItem into the WebScene. That WebScene can then be used as the map to power the SceneView. To get a refresher on how the Map and View relationship works in the ArcGIS JS API 4.0 beta, you can take a look at this blog post.

 

Here is a sample of this scene.

 

3D Scene Sample on jsbin.com

 

Not only do you get Web Scenes, you get Local Scenes. Here is a sample of a local scene. Soak that in folks. I know you oil and gas people are salivating. You can basically clip a 3D scene to localize an area and view underground data. You can then load this data into your application view the WebScene module.

 

Who needs 2D maps.

 

So take a crack at the SceneViewer and turn some of your stale old 2D data into a 3D masterpiece!

 

For more geodev tips and tricks, check out my blog.

Outcomes