Raster hillshade renderer

View inWPFUWPFormsiOSAndroid
View on GitHub

Use a hillshade renderer on a raster.

screenshot

How to use the sample

Configure the options for rendering, then tap 'Apply hillshade'.

How it works

  1. The parameters provided by the user are passed to HillshadeRender at instantiation: new HillshadeRenderer(mAltitude, mAzimuth, mZFactor, mSlopeType, mPixelSizeFactor, mPixelSizePower, mOutputBitDepth); which returns a RasterRenderer. The RasterRenderer is then added to the RasterLayer.

Offline data

This sample downloads the following items from ArcGIS Online automatically:

Tags

Visualization, hillshade, raster, shadow, slope

Sample Code

RasterHillshade.xamlRasterHillshade.xaml.cs
                                                                               
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
71
72
73
74
75
76
77
78
79
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="ArcGISRuntime.Samples.RasterHillshade.RasterHillshade"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
    Title="Raster hillshade">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="180" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <esriUI:MapView x:Name="MyMapView" Grid.Row="1" />
        <Grid
            Grid.Row="0"
            Margin="2"
            HorizontalOptions="CenterAndExpand"
            VerticalOptions="Start">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="2*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Label
                Grid.Row="0"
                Grid.Column="0"
                Text="Slope type:"
                VerticalOptions="Center" />
            <Picker
                x:Name="SlopeTypePicker"
                Grid.Row="0"
                Grid.Column="1"
                HorizontalOptions="StartAndExpand"
                VerticalOptions="CenterAndExpand" />
            <Label
                Grid.Row="1"
                Grid.Column="0"
                HorizontalTextAlignment="End"
                Text="Altitude:"
                VerticalOptions="Center" />
            <Slider
                x:Name="AltitudeSlider"
                Grid.Row="1"
                Grid.Column="1"
                Maximum="90"
                MaximumTrackColor="CadetBlue"
                Minimum="0"
                MinimumTrackColor="CadetBlue" />
            <Label
                Grid.Row="2"
                Grid.Column="0"
                HorizontalTextAlignment="End"
                Text="Azimuth:"
                VerticalOptions="Center" />
            <Slider
                x:Name="AzimuthSlider"
                Grid.Row="2"
                Grid.Column="1"
                Maximum="360"
                MaximumTrackColor="CadetBlue"
                Minimum="0"
                MinimumTrackColor="CadetBlue" />
            <Button
                x:Name="ApplyHillshadeButton"
                Grid.Row="3"
                Grid.ColumnSpan="2"
                Margin="20,0"
                Clicked="ApplyHillshadeButton_Click"
                HorizontalOptions="CenterAndExpand"
                Text="Apply hillshade"
                VerticalOptions="Center" />
        </Grid>
    </Grid>
</ContentPage>

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