List transformations by suitability

This sample demonstrates how to use the TransformationCatalog to get a list of available DatumTransformations that can be used to project a Geometry between two different SpatialReferences, and how to use one of the transformations to perform the GeometryEngine.Project operation. The TransformationCatalog is also used to set the location of files upon which grid-based transformations depend, and to find the default transformation used for the two SpatialReferences.

List datum transformations by suitability

Instructions

Tap on a listed transformation to re-project the point geometry (shown with a blue square) using the selected transformation. The reprojected geometry will be shown in red. If there are grid-based transformations for which projection engine files are not available locally, these will be shown in gray in the list. The default transformation is shown in bold. To download the additional transformation data, log on to your developers account (https://developers.arcgis.com), click the Download APIs button on the dashboard page, and download the Coordinate System Data archive from the Supplemental ArcGIS Runtime Data tab. Unzip the archive to the SampleData sub-folder of the ApplicationData directory, which can be found for each platform at run time with System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData).

Code

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage 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"
             xmlns:local="clr-namespace:ArcGISRuntimeXamarin.Samples.ListTransformations"
             x:Class="ArcGISRuntimeXamarin.Samples.ListTransformations.ListTransformations">
    <ContentPage.Resources>
        <ResourceDictionary>
            <local:TransformRowTemplateSelector x:Key="TransformTemplateSelector"/>
        </ResourceDictionary>
    </ContentPage.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="320"/>
        </Grid.RowDefinitions>
        <esriUI:MapView x:Name="MyMapView"
                      Grid.Row="0" />
        <Grid Grid.Row="1"
              WidthRequest="380"
              HorizontalOptions="Center">
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="50"/>
                <RowDefinition Height="140"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <StackLayout Grid.Row="0"
                        Orientation="Horizontal"
                        Margin="0,10">
                <Label x:Name="InSpatialRefTextBox"
                       Margin="10,0,30,0"/>
                <Label x:Name="OutSpatialRefTextBox"/>
            </StackLayout>
            <StackLayout Grid.Row="1"
                        Orientation="Horizontal"
                        Margin="0,10">
                <Label Text="Use extent"
                       VerticalOptions="Center"
                       Margin="10,0"/>
                <Switch x:Name="UseExtentSwitch"
                      IsToggled="False"
                        VerticalOptions="Center"
                    Toggled="UseExtentSwitch_Toggled"/>
            </StackLayout>
            <ListView x:Name="TransformationsListBox"
                     Grid.Row="2"
                     WidthRequest="340" HeightRequest="140"
                      HasUnevenRows="True"
                      ItemTemplate="{StaticResource TransformTemplateSelector}"
                     ItemsSource="{Binding Path=SuitableTransformationsList}"
                     ItemSelected="TransformationsListBox_ItemSelected"/>
            <Label x:Name="MessagesTextBox"
                       Grid.Row="3"
                       WidthRequest="340" HeightRequest="80"/>
        </Grid>
    </Grid>
</ContentPage>


In this topic
  1. Instructions
  2. Code