This sample shows how to add an instance of ImageryTileLayer to a
Map in a MapView. The ImageryTileLayer in this sample
contains world tiled elevation data. The destination-in
composite blendMode
is set on the layer. This blend mode masks the contents of the background layer (in this case the world imagery tile layer) where the contents
of both layers overlap. Everything else is removed from the result. So the blended result shows the high elevation areas of the world.
const url = "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";
// create a ImageryTileLayer from tiled elevation service
const layer = new ImageryTileLayer({
url: url,
title: "World Elevation ImageryTileLayer",
blendMode: "destination-in"
});
This layer is then added a GroupLayer along with the World Imagery TileLayer to isolate the blending effects set on the ImageryTileLayer from the rest of the map.
// Create a group layer containing the imagery tile layer and a tile layer
// this group layer is used to isolate the destination-in blendMode from the
// rest of the map.
const groupLayer = new GroupLayer({
title: "Group Layer",
layers: [
new TileLayer({
url: "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer",
listMode: "hide-children"
}),
layer
]
});
The sample also shows how to leverage client-side rendering by changing the parameters of the RasterStretchRenderer
set on the imagery tile layer. The user can update the Raster
parameters at runtime and see the changes immediately.
To change the renderer properties, you must first clone the renderer, then change the property, and then set the new renderer back on the layer. The update
function in the sample is called whenever the user changes the renderer properties by interacting with the user interface.
// This function is called when the layer view is loaded
// or when user changes the renderer settings from the UI
const updateRenderer = () => {
// clone the layer renderer
// layer's renderer needs to be cloned if it changes at runtime
const renderer = layer.renderer.clone();
renderer.colorRamp = {
type: "algorithmic",
fromColor: [0, 0, 0, 0],
toColor: [0, 0, 0, 1]
};
const bandStat = layer.rasterInfo.statistics[0];
renderer.stretchType = stretchType;
switch (stretchType) {
case "min-max":
renderer.statistics = [
{
min: valueSlider.values[0],
max: valueSlider.values[1],
avg: bandStat.avg,
stdev: bandStat.stddev
}
];
break;
case "standard-deviation":
renderer.numberOfStandardDeviations = valueSlider.values[0];
renderer.statistics = [bandStat];
break;
}
// apply the cloned renderer back to the layer's renderer
// changes will be immediate
layer.renderer = renderer;
};