SOE Elevation Profile Viewer

This sample demonstrates how to use a custom Server Object Extension (SOE) hosted by ArcGIS Server. More information on SOEs can be found here.

The SOE is accessible via the ArcGIS for Server REST API. A web request is programmatically constructed by populating argument\value pairs to match parameters defined by the SOE's REST schema (discoverable via the ArcGIS for Server REST Services Directory). The response from the SOE contains string data in JSON (JavaScript Object Notation) format.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.SOEElevationProfileViewer"
             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/client/2009"
             xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">
    <Grid>
        <DockPanel LastChildFill="True">

            <Grid DockPanel.Dock="Bottom" Name="bottomGrid" Visibility="Collapsed">
                <Grid Height="200">
                    <chartingToolkit:Chart Name="profileChart" 
                                       Title="Elevation Profile" 
                                       Margin="0" 
                                       HorizontalAlignment="Stretch" 
                                       VerticalAlignment="Stretch">

                        <chartingToolkit:Chart.LegendStyle>
                            <Style TargetType="Control">
                                <Setter Property="Width" Value="0"/>
                                <Setter Property="Height" Value="0"/>
                            </Style>
                        </chartingToolkit:Chart.LegendStyle>

                        <chartingToolkit:AreaSeries DependentValuePath="Value" 
                                                IndependentValuePath="Key" 
                                                ItemsSource="{Binding Path=ValueList}"
                                                IsSelectionEnabled="True"
                                                Height="100"
                                                Background="{x:Null}" Foreground="Blue">
                            <chartingToolkit:AreaSeries.DependentRangeAxis>
                                <chartingToolkit:LinearAxis Minimum="{Binding Path=Info[0]}" Maximum="{Binding Path=Info[1]}" Orientation="Y" Interval="{Binding Path=Info[2]}" ShowGridLines="True"></chartingToolkit:LinearAxis>
                            </chartingToolkit:AreaSeries.DependentRangeAxis>

                            <chartingToolkit:AreaSeries.PathStyle>
                                <Style TargetType="Path">
                                    <Setter Property="Stroke" Value="DarkBlue"/>
                                    <Setter Property="StrokeThickness" Value="2.5"/>
                                    <Setter Property="Opacity" Value="0.75"/>
                                </Style>
                            </chartingToolkit:AreaSeries.PathStyle>

                            <chartingToolkit:AreaSeries.DataPointStyle>
                                <Style TargetType="{x:Type chartingToolkit:AreaDataPoint}">
                                    <Setter Property="Width" Value="7"/>
                                    <Setter Property="Height" Value="7"/>
                                    <Setter Property="Background" Value="DodgerBlue"/>
                                    <Setter Property="DependentValueStringFormat" Value="Elevation = {0:N2} meters"/>
                                </Style>
                            </chartingToolkit:AreaSeries.DataPointStyle>

                        </chartingToolkit:AreaSeries>
                    </chartingToolkit:Chart>
                    <Grid.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="White" Offset="0" />
                            <GradientStop Color="#FFADABAB" Offset="1" />
                            <GradientStop Color="#FFF0F0F0" Offset="0.206" />
                        </LinearGradientBrush>
                    </Grid.Background>
                </Grid>
            </Grid>
              
            <Grid x:Name="LayoutRoot">
                <Grid.Resources>
                    <esri:SimpleMarkerSymbol x:Key="RedCircleSymbol" Color="Red" Style="Circle" Size="11" />
                    <esri:SimpleLineSymbol x:Key="BlueLineSymbol" Color="Blue" Width="4" />
                    <esri:SimpleFillSymbol x:Key="GreenFillSymbol" Fill="Transparent" BorderBrush="Green" BorderThickness="4" />
                </Grid.Resources>

                <esri:Map x:Name="MyMap" UseAcceleratedDisplay="True" Extent="-15000000,2000000,-7000000,8000000">
                    <esri:ArcGISTiledMapServiceLayer ID="National Geographic" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
                    <esri:GraphicsLayer ID="inputsGraphicsLayer"/>
                </esri:Map>

                <Border BorderBrush="Black" BorderThickness="1" Height="135" Width="175" HorizontalAlignment="Left" VerticalAlignment="Top" Background="White" Margin="10">
                    <Border.Effect>
                        <DropShadowEffect ShadowDepth="1" />
                    </Border.Effect>
                    <StackPanel>
                        <TextBlock Text="Elevation Profile:" FontWeight="Bold" TextWrapping="Wrap" Margin="5,5,5,0"/>
                        <TextBlock Text="Click Get Elevation Profile then draw a line on the map to retrieve the elevation profile." 
                           TextWrapping="Wrap" Margin="5,5,5,0"/>
                        <Button x:Name="GetProfileButton" Click="GetProfileButton_Click" Content="Get Elevation Profile" ToolTip="Get Elevation Profile"
                        Height="auto" HorizontalAlignment="Center" VerticalAlignment="Top" Width="auto" Margin="5">
                        </Button>
                        <Button x:Name="ClearButton" Click="ClearButton_Click" Content="Clear Results" ToolTip="Clear"
                        Height="auto" HorizontalAlignment="Center" VerticalAlignment="Top" Width="auto" Margin="5,0,5,5">
                        </Button>
                    </StackPanel>
                </Border>
            </Grid>

        </DockPanel>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014