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"
});
Constructors
new Ground(properties)
properties Object See the properties for a list of all the properties that may be passed into the constructor. |
Property Overview
Name | Type | Summary | |
---|---|---|---|
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
.layersCollection
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.
When the layers collection is empty, the ground surface is flat.
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
Name | Return Type | Summary | |
---|---|---|---|
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:Type Description Ground A 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:
Property Type Description geometry Point/Polyline/Multipoint The 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.noDataValue number The value used when there is no data available. The
sampleInfo
property of the result will be returned ifoptions.returnSampleInfo
is set and contains the following properties (for each coordinate):Property Type Description demResolution number The 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.source ElevationLayer The elevation source from which the data for the corresponding coordinate was sampled. Parameters:geometry Point | Multipoint | PolylineThe geometry to sample.
optionaloptions ObjectAdditional query options.
Specification:optionalreturnSampleInfo BooleanIndicates whether to return additional sample information for each sampled coordinate.
Default Value: falseoptionalnoDataValue NumberThe value that appears in the resulting geometry when there is no data available.
Default Value: 0Returns:Type Description Promise Resolves 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); }); });