require(["esri/Ground"], function(Ground) { /* code goes here */ });
Class: esri/Ground
Inheritance: Ground Accessor
Since: ArcGIS API for JavaScript 4.0

The Ground class contains properties that specify how the ground surface is displayed in a SceneView. It contains a layers property, which is a collection of ElevationLayer that defines the elevation or terrain of the map's surface.

On a SceneView instance, a default ground surface using the World Elevation Service can conveniently be initialized through the ground property:

var map = new Map({
  basemap: "topo",
  ground: "world-elevation"
});
See also:

Constructors

new Ground(properties)

Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummary
String

The name of the class.

more details
more details
Collection

A collection of ElevationLayers that define the elevation or terrain that makes up the ground surface.

more details
more details

Property Details

declaredClassStringreadonly

The name of the class. The declared class name is formatted as esri.folder.className.

A collection of ElevationLayers that define the elevation or terrain that makes up the ground surface. When elevation layers are added to the ground, the topographical variations of the surface are rendered in 3D as they would appear in the real world.

elev-default

When the layers collection is empty, the ground surface is flat.

no-elev

Example:
// Adds the esri world elevation service to the ground
var layer = new ElevationLayer({
  url: "//elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
});
map.ground.layers.add(layer);

Method Overview

NameReturn TypeSummary
Ground

Creates a deep clone of this object.

more details
more details
Promise

Queries the ground layer services for elevation values for the given geometry.

more details
more details

Method Details

clone(){Ground}

Creates a deep clone of this object.

Returns:
TypeDescription
GroundA deep clone of the Ground instance that invoked this method.

queryElevation(geometry, options){Promise}

Queries the ground layer services for elevation values for the given geometry. The returned result contains a copy of the geometry with z-values sampled from elevation data from the first layer that has data available.

The returned promise resolves with a plain object containing the following properties:

PropertyTypeDescription
geometryPoint/Polyline/MultipointThe geometry with sampled z-values.
sampleInfo?Object[]Contains additional information about how the geometry was sampled. This property is present depending on whether the user set options.returnSampleInfo = true, for each coordinate in the geometry.
noDataValuenumberThe value used when there is no data available.

The sampleInfo property of the result will be returned if options.returnSampleInfo is set and contains the following properties (for each coordinate):

PropertyTypeDescription
demResolutionnumberThe resolution at which the z-value was sampled. If no data was available for sampling for a given coordinate, the dem resolution value will be -1 for that coordinate.
sourceElevationLayerThe elevation source from which the data for the corresponding coordinate was sampled.
Parameters:

The geometry to sample.

options Object
optional

Additional query options.

Specification:
returnSampleInfo Boolean
optional

Indicates whether to return additional sample information for each sampled coordinate.

Default Value: false

noDataValue Number
optional

The value that appears in the resulting geometry when there is no data available.

Default Value: 0

Returns:
TypeDescription
PromiseResolves to an object with the sampled geometry, resolution information, and no data value.
Example:
require(["esri/Map", "esri/geometry/Multipoint"], function(Map, Multipoint) {
  var map = new Map({
    ground: "world-elevation"
  });

  // Various points across a ridge of the mount everest
  var points = [
     [ 86.9252, 27.9883 ],
     [ 86.9265, 27.9894 ],
     [ 86.9292, 27.9923 ],
     [ 86.9324, 27.9960 ],
     [ 86.9359, 27.9992 ]
   ];

  map.ground.queryElevation(new Multipoint(points), { returnSampleInfo: true })

    // Successfully sampled all points
    .then(function(result) {
      // Print result of each sampled point to the console
      result.geometry.points.forEach(function(point, index) {
        var elevation = Math.round(point[2]);
        var resolution = result.sampleInfo[index].demResolution;

        var coordinateText = "(" + point[0] + ", " + point[1] + ")";
        var resolutionText = Math.round(resolution) + " meter resolution";

        console.log("Sampled " + coordinateText + ": " + elevation + " at " + resolutionText);
      });
    })

    // Failed to sample (e.g. service unavailable)
    .otherwise(function(error) {
      console.error("Failed to query elevation:", error);
    });
});

API Reference search results

NameTypeModule

There were no match results from your search criteria.