View in MAUI WPF WinUI View on GitHub
import InlineCode from "@esri-dx/starship-doc-components/components/InlineCode.astro";

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
    from a grayscale raster file.
  2. Create a
    from the raster.
  3. Create a
    from the raster layer and set it to the map.
  4. Create a
    , specifying the slope type and other properties,
    .
  5. Set the hillshade renderer to be used on the raster layer with
    .

Relevant API

  • Basemap
  • HillshadeRenderer
  • Raster
  • RasterLayer

Offline data

This sample downloads the Hillshade raster portal item from ArcGIS Online automatically.

Tags

altitude, angle, azimuth, raster, slope, visualization

Sample Code

RasterHillshade.xaml RasterHillshade.xaml RasterHillshade.xaml.cs
<UserControl x:Class="ArcGIS.WinUI.Samples.RasterHillshade.RasterHillshade"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
<Grid>
<esriUI:MapView x:Name="MyMapView" />
<Border Style="{StaticResource BorderStyle}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="2*" />
</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"
HorizontalAlignment="Stretch" />
<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"
IsThumbToolTipEnabled="True"
Maximum="90"
Minimum="0" />
<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"
IsThumbToolTipEnabled="True"
Maximum="360"
Minimum="0" />
<Button x:Name="ApplyHillshadeButton"
Grid.Row="3"
Grid.ColumnSpan="2"
Margin="5,0"
Padding="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Click="ApplyHillshadeButton_Click"
Content="Apply hillshade" />
</Grid>
</Border>
</Grid>
</UserControl>