Hillshade renderer

View inAndroidFormsUWPWPFWinUIiOSView on GitHubSample viewer app

Apply a hillshade renderer to a raster.

Image of hillshade renderer

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

Relevant API

  • Basemap
  • HillshadeRenderer
  • Raster
  • RasterLayer

Offline data

This sample uses a digital elevation map from ArcGIS Online.

Tags

altitude, angle, azimuth, raster, slope, visualization

Sample Code

RasterHillshade.xamlRasterHillshade.xamlRasterHillshade.xaml.cs
Use dark colors for code blocksCopy
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<UserControl x:Class="ArcGISRuntime.WPF.Samples.RasterHillshade.RasterHillshade"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="3*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0"
                           Grid.Column="0"
                           VerticalAlignment="Center"
                           Text="Slope type:"
                           TextAlignment="Right" />
                <ComboBox x:Name="SlopeTypeCombo"
                          Grid.Row="0"
                          Grid.Column="1"
                          Margin="5" />
                <TextBlock Grid.Row="1"
                           Grid.Column="0"
                           VerticalAlignment="Center"
                           Text="Altitude:"
                           TextAlignment="Right" />
                <Slider x:Name="AltitudeSlider"
                        Grid.Row="1"
                        Grid.Column="1"
                        Margin="5"
                        Maximum="90"
                        Minimum="0">
                    <Slider.ToolTip>
                        <ToolTip Content="{Binding RelativeSource={RelativeSource Self}, Path=PlacementTarget.Value}" ContentStringFormat="{}{0:0}" />
                    </Slider.ToolTip>
                </Slider>
                <TextBlock Grid.Row="2"
                           Grid.Column="0"
                           VerticalAlignment="Center"
                           Text="Azimuth:"
                           TextAlignment="Right" />
                <Slider x:Name="AzimuthSlider"
                        Grid.Row="2"
                        Grid.Column="1"
                        Margin="5"
                        Maximum="360"
                        Minimum="0">
                    <Slider.ToolTip>
                        <ToolTip Content="{Binding RelativeSource={RelativeSource Self}, Path=PlacementTarget.Value}" ContentStringFormat="{}{0:0}" />
                    </Slider.ToolTip>
                </Slider>
                <Button x:Name="ApplyHillshadeButton"
                        Grid.Row="3"
                        Grid.Column="0"
                        Grid.ColumnSpan="2"
                        Margin="5"
                        Padding="3"
                        Click="ApplyHillshadeButton_Click"
                        Content="Apply hillshade"
                        IsEnabled="False" />
            </Grid>
        </Border>
    </Grid>
</UserControl>

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