Hillshade renderer

Loading

Code

import QtQuick 2.6
import QtQuick.Controls 1.4
import Esri.ArcGISRuntime 100.3
import Esri.ArcGISExtras 1.1

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600
    
    property url dataPath: System.userHomePath + "/ArcGIS/Runtime/Data/raster"
    property real scaleFactor: System.displayScaleFactor

    MapView {
        id: mapView
        anchors.fill: parent

        Map {
            Basemap {
                // add a raster to the basemap
                RasterLayer {
                    id: rasterLayer

                    Raster {
                        path: dataPath + "/srtm.tiff"
                    }

                    // declare a HillshadeRaster as a child of RasterLayer,
                    // as renderer is a default property of RasterLayer
                    HillshadeRenderer {
                        altitude: 45
                        azimuth: 315
                        zFactor: 0.000016
                        slopeType: Enums.SlopeTypeNone
                        pixelSizeFactor: 1
                        pixelSizePower: 1
                        outputBitDepth: 8
                    }
                }
            }

            onLoadStatusChanged: {
                if (loadStatus === Enums.LoadStatusLoaded) {
                    mapView.setViewpointScale(754479);
                }
            }
        }
    }

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

    HillshadeSettings {
        id: hillshadeSettings
        anchors.fill: parent
    }

    function applyHillshadeRenderer(altitude, azimuth, slope) {
        // create the new renderer
        var hillshadeRenderer = ArcGISRuntimeEnvironment.createObject("HillshadeRenderer", {
                                                                          altitude: altitude,
                                                                          azimuth: azimuth,
                                                                          zFactor: 0.000016,
                                                                          slopeType: slope,
                                                                          pixelSizeFactor: 1,
                                                                          pixelSizePower: 1,
                                                                          outputBitDepth: 8
                                                                      });

        // set the renderer on the layer
        rasterLayer.renderer = hillshadeRenderer;
    }
}


In this topic
  1. Code