Hillshade renderer

View inQMLC++
View on GitHub
Sample viewer app

Apply a hillshade renderer to a raster.

screenshot

Use case

An environmental agency may track coastal erosion by comparing images of an area taken over a a longer period of time with hillshade renderers applied.

How to use the sample

Choose and adjust the settings to update the hillshade renderer on the raster layer. The sample allows you to change the Altitude, Azimuth, and Slope Type.

How it works

  1. Create a Raster from a grayscale raster file.
  2. Create a RasterLayer from the raster.
  3. Create a Basemap from the raster layer and set it to the map.
  4. Create a HillshadeRenderer, specifying the slope type and other properties, new HillshadeRenderer(Altitude, Azimuth, ZFactor, SlopeType, PixelSizeFactor, PixelSizePower, OutputBitDepth).
  5. Set the hillshade renderer to be used on the raster layer with rasterLayer::setRenderer(renderer).

Relevant API

  • Basemap
  • HillshadeRenderer
  • Raster
  • RasterLayer

Offline Data

Read more about how to set up the sample's offline data here.

Link Local Location
Hillshade raster <userhome>/ArcGIS/Runtime/Data/raster/srtm.tiff

Tags

altitude, angle, azimuth, raster, slope, visualization

Sample Code

Hillshade_Renderer.qmlHillshadeSettings.qmlHillshadeSlopeTypeModel.qmlHillshade_Renderer.cppHillshade_Renderer.h
                                               
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// [WriteFile Name=Hillshade_Renderer, Category=Layers]
// [Legal]
// Copyright 2016 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

import QtQuick 2.6
import QtQuick.Controls 2.2
import Esri.Samples 1.0

Hillshade_RendererSample {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    // add a mapView component
    MapView {
        anchors.fill: parent
        objectName: "mapView"
    }

    Button {
        anchors {
            horizontalCenter: parent.horizontalCenter
            bottom: parent.bottom
            bottomMargin: 25
        }
        text: "Edit Renderer"
        onClicked: hillshadeSettings.visible = true;
    }

    HillshadeSettings {
        id: hillshadeSettings
        anchors.fill: parent
    }
}

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