Titling SceneView at ground-level. How to code?

377
1
10-04-2017 11:58 PM
KittyYiu
New Contributor II

Beginner JS coder needs help, Thank-you. I attempted to follow along the webinar or online demo codes but still can't troubleshoot.

I want to code the 3D map (SceneView) to able pan at ground-level, let say seeing the mountain terrains. Now I can only pan the globe around at a perpendicular view.

What have I missed or did wrong in the codes?

https://codepen.io/yiuklh/pen/eGmmov 

0 Kudos
1 Reply
ThomasSolow
Occasional Contributor III

In your code, this segment won't work:

//create elevation layer add to map
var elevLyr = new ElevationLayer({
  // Custom elevation service
  url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation  /ESRI_Elevation_World/GPServer",
  visible: false
});
// Add elevation layer to the map's ground.
map.ground.layers.add(elevLyr);‍‍‍‍‍‍‍‍

The URL needs to point to an elevation service, which will look more or less like a tiled image service.  You've already added the world elevation layer by setting ground to 'world-elevation' in the map constructor.

As far as panning along the ground, by default you can use the left and right arrow keys to move the camera left and right and maintain the camera's current tilt and heading.  To get a good look at terrain you'll have to zoom in and tilt the camera first.

In order to tilt the camera, you could clone the current camera and change the tilt:

var cam = view.camera.clone();
cam.tilt = 90; //degrees

view.camera = cam;

or use goTo:

view.goTo({ tilt: 90});