ImageryTileLayer - shaded relief renderer

This sample shows how to set a RasterShadedReliefRenderer on an instance of ImageryTileLayer. RasterShadedReliefRenderer produces a grayscale or colored 3D representation of the surface on an ImageryLayer or ImageryTileLayer, with the sun's relative position taken into account for shading the image. This renderer uses the altitude and azimuth properties to specify the sun's position.

The layer in this sample contains cached global elevation data with controls to change the renderer parameters at run-time directly on the client-side.

The code below shows how to create the RasterShadedReliefRenderer and set it on the ImageryTileLayer.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
const renderer = new RasterShadedReliefRenderer({
  altitude: 45, // angle of elevation above the horizon
  azimuth: 315, // position along the horizon
  hillshadeType: hillshadeType, // either "traditional" or "multi-directional"
  zFactor: 1,
  scalingType: "adjusted",
  colorRamp: colorRamp
});

const layer = new ImageryTileLayer({
  url: url,
  renderer: renderer // set the renderer on the layer
});

The renderer parameters dynamically adjust at runtime based on user interaction with the various options available at the top right corner of the application. The renderer instantly updates as users modify the different options.

At version 4.29, this sample was updated to leverage the colorRamps module for creating a MultipartColorRamp. The module provides convenient utility methods that simplify the creation of MultipartColorRamp and AlgorithmicColorRamp.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.