Project
This sample demonstrates using the ArcGIS Runtime SDK for WPF to perform a geometry operation that takes an input graphic point that was created using decimal degrees and projects the return graphic point to Web Mercator.
To use the sample, enter an X and Y coordinate value in decimal degrees (WGS84) and click Project to transform the coordinate to Web Mercator and add it to the map.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalProject" 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"> <Grid x:Name="LayoutRoot" Background="White"> <Grid.Resources> <esri:SimpleMarkerSymbol x:Key="RoundMarkerSymbol" Size="10"> <esri:SimpleMarkerSymbol.Color> <RadialGradientBrush> <GradientStop Color="Yellow" Offset="0.578"/> <GradientStop Color="#FF0E0D07" Offset="1"/> </RadialGradientBrush> </esri:SimpleMarkerSymbol.Color> </esri:SimpleMarkerSymbol> <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" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" > <esri:ArcGISLocalTiledLayer ID="BaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/> <esri:GraphicsLayer ID="ProjectGraphicsLayer" x:Name="_ProjectGraphicsLayer" > <esri:GraphicsLayer.MapTip> <Border CornerRadius="10" BorderBrush="#FF222957" BorderThickness="3" Margin="0,0,15,15"> <Border.Background> <LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188"> <GradientStop Color="#FFD1DFF2"/> <GradientStop Color="#FF0088FF" Offset="0.946"/> </LinearGradientBrush> </Border.Background> <Border.Effect> <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" /> </Border.Effect> <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="10"> <TextBlock Text="Input coordinate: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/> <StackPanel Orientation="Horizontal"> <TextBlock Text="X: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/> <TextBlock Text="{Binding [Input_CoordinateX]}" HorizontalAlignment="Left" VerticalAlignment="Center" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Y: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/> <TextBlock Text="{Binding [Input_CoordinateY]}" HorizontalAlignment="Left" VerticalAlignment="Center" /> </StackPanel> <TextBlock Text="Output coordinate: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center" /> <StackPanel Orientation="Horizontal"> <TextBlock Text="X: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center"/> <TextBlock Text="{Binding [Output_CoordinateX]}" HorizontalAlignment="Left" VerticalAlignment="Center" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Y: " FontWeight="Bold" Foreground="#FF0F274E" FontSize="10" VerticalAlignment="Center" /> <TextBlock Text="{Binding [Output_CoordinateY]}" HorizontalAlignment="Left" VerticalAlignment="Center" /> </StackPanel> </StackPanel> </Border> </esri:GraphicsLayer.MapTip> </esri:GraphicsLayer> </esri:Map> <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,10,10,0" > <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" /> <StackPanel Orientation="Vertical" Margin="30,20,20,30" > <TextBlock x:Name="ResponseTextBlock" Text="Enter an X and Y coordinate value in decimal degrees (WGS84) and click Project to transform the coordinate to Web Mercator and add it to the map." Width="200" TextAlignment="Left" TextWrapping="Wrap" Margin="0,0,0,5" Foreground="Black"/> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal" Margin="3"> <TextBlock Text="X:" VerticalAlignment="Center" Margin="3" Foreground="Black" /> <TextBox x:Name="XTextBox" Text="-121"/> </StackPanel> <StackPanel Orientation="Horizontal" Margin="3"> <TextBlock Text="Y:" Margin="3" VerticalAlignment="Center" Foreground="Black" /> <TextBox x:Name="YTextBox" Text="40" /> </StackPanel> </StackPanel> <Button Content="Project" Margin="0,5,5,0" Click="ProjectButton_Click" /> </StackPanel> </Grid> </Grid> </UserControl>
5/16/2014