Reverse Geocode

This sample demonstrates using the ArcGIS Runtime SDK for WPF to reverse-geocoding points using a LocalGeocodeService and a Locator. To use the sample, simply click on or near a street in the map. When a result is found, it will be drawn on the map with the returned address in the graphic's MapTip.

In the code-behind, a LocalGeocodeService is started and the Url is used to create a Locator to perform an address lookup operation for the clicked point. When a result is returned, a graphic is added to the map, and the address is added to the graphic's attributes such that it shows up in the graphic's MapTip.

The supported source for a LocalGeocodeService is an ArcGIS Locator Package (. gcpk ), which can be authored in ArcGIS for Desktop.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LocalReverseGeocode"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
   xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
   mc:Ignorable="d" 
   d:DesignHeight="300" d:DesignWidth="300">
    <Grid Name="LayoutRoot">
        <Grid.Resources>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
            <esri:MarkerSymbol x:Key="StrobeMarkerSymbol">
                <esri:MarkerSymbol.ControlTemplate>
                    <ControlTemplate>
                        <Canvas>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard RepeatBehavior="Forever">
                                            <DoubleAnimation BeginTime="0"
                                                                 Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
                                                                 From="1" To="10" Duration="00:00:02" />
                                            <DoubleAnimation BeginTime="0"
                                                                 Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
                                                                 From="1" To="10" Duration="00:00:02" />
                                            <DoubleAnimation BeginTime="0"
                                                                 Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                 From="1" To="0" Duration="00:00:01" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Ellipse Height="10" Width="10" Canvas.Left="-5" Canvas.Top="-5" 
                                         RenderTransformOrigin="0.5,0.5" x:Name="ellipse"
                                         IsHitTestVisible="False">
                                <Ellipse.RenderTransform>
                                    <ScaleTransform />
                                </Ellipse.RenderTransform>
                                <Ellipse.Fill>
                                    <RadialGradientBrush>
                                        <GradientStop Color="#00FF0000" />
                                        <GradientStop Color="#FFFF0000" Offset="0.25"/>
                                        <GradientStop Color="#00FF0000" Offset="0.5"/>
                                        <GradientStop Color="#FFFF0000" Offset="0.75"/>
                                        <GradientStop Color="#00FF0000" Offset="1"/>
                                    </RadialGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse Height="10" Width="10" Canvas.Left="-5" Canvas.Top="-5" 
                                         Fill="#FFFF0000" x:Name="ellipse1"/>
                        </Canvas>
                    </ControlTemplate>
                </esri:MarkerSymbol.ControlTemplate>
            </esri:MarkerSymbol>
            <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF145787" Offset="0.16"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.502"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>
        </Grid.Resources>
        <esri:Map x:Name="MyMap" Background="#FFE3E3E3" IsEnabled="False" MouseClick="MyMap_MouseClick" Extent="-122.519985221, 37.836494682 ,-122.302264539 , 37.698485944">
            <esri:ArcGISLocalTiledLayer Path="..\Data\TPKS\SanFrancisco.tpk"/>
            <esri:GraphicsLayer ID="MyGraphicsLayer">
                <esri:GraphicsLayer.MapTip>
                    <Grid Background="LightYellow">
                        <StackPanel Orientation="Vertical" Margin="5" >
                            <TextBlock Text="{Binding [Address1]}" HorizontalAlignment="Left" Foreground="Black" />
                            <TextBlock Text="{Binding [LatLon]}" HorizontalAlignment="Left" Foreground="Black" />
                        </StackPanel>
                        <Border BorderBrush="Black" BorderThickness="1" />
                    </Grid>
                </esri:GraphicsLayer.MapTip>
            </esri:GraphicsLayer>
        </esri:Map>
        <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,15,0" Width="350" >
            <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5">
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
            <TextBlock x:Name="InformationText" Text="Click on or near a street in the map to define a location. The address of the location will be displayed in a MapTip when the cursor hovers over the marker." 
                HorizontalAlignment="Center" VerticalAlignment="Top" TextAlignment="Left" Margin="30,20,20,30" TextWrapping="Wrap" Foreground="Black"/>
        </Grid>
        <ProgressBar x:Name="MyProgressBar" IsIndeterminate="True" VerticalAlignment="Bottom" Width="200" Height="20" Margin="10" Visibility="{Binding Path=IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"></ProgressBar>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014