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.
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.