List transformations by suitability

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Get a list of suitable transformations for projecting a geometry between two spatial references with different horizontal datums.

Image of list transformations by suitability

Use case

Transformations (sometimes known as datum or geographic transformations) are used when projecting data from one spatial reference to another when there is a difference in the underlying datum of the spatial references. Transformations can be mathematically defined by specific equations (equation-based transformations), or may rely on external supporting files (grid-based transformations). Choosing the most appropriate transformation for a situation can ensure the best possible accuracy for this operation. Some users familiar with transformations may wish to control which transformation is used in an operation.

How to use the sample

Select a transformation from the list to see the result of projecting the point from EPSG:27700 to EPSG:3857 using that transformation. The result is shown as a red cross; you can visually compare the original blue point with the projected red cross.

Select 'Consider current extent' to limit the transformations that are appropriate for the current extent.

If the selected transformation is not usable (has missing grid files) then an error is displayed.

How it works

  1. Pass the input and output spatial references to TransformationCatalog.GetTransformationsBySuitability for transformations based on the map's spatial reference OR additionally provide an extent argument to only return transformations suitable to the extent. This returns a list of ranked transformations.
  2. Use one of the DatumTransformation objects returned to project the input geometry to the output spatial reference.

Relevant API

  • DatumTransformation
  • GeographicTransformation
  • GeographicTransformationStep
  • GeometryEngine
  • GeometryEngine.Project
  • TransformationCatalog

About the data

The map starts out zoomed into the grounds of the Royal Observatory, Greenwich. The initial point is in the British National Grid spatial reference, which was created by the United Kingdom Ordnance Survey. The spatial reference after projection is in web mercator.

Additional information

Some transformations aren't available until transformation data is provided.

This sample uses a GeographicTransformation, which extends the DatumTransformation class. As of 100.9, ArcGIS Runtime also includes a HorizontalVerticalTransformation, which also extends DatumTransformation. The HorizontalVerticalTransformation class is used to transform coordinates of z-aware geometries between spatial references that have different geographic and/or vertical coordinate systems.

This sample can be used with or without provisioning projection engine data to your device. If you do not provision data, a limited number of transformations will be available.

To download projection engine data to your device:

  1. Log in to the ArcGIS for Developers site using your Developer account.
  2. In the Dashboard page, tap 'Download APIs and SDKs'.
  3. Tap the download button next to Projection Engine Data to download projection engine data to your computer.
  4. Unzip the downloaded data on your computer.
  5. Create an ~/ArcGIS/Runtime/Data/PEDataRuntime directory on your device and copy the files to this directory.

Tags

datum, geodesy, projection, spatial reference, transformation

Sample Code

ListTransformations.xamlListTransformations.xamlListTransformations.xaml.cs
Use dark colors for code blocksCopy
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
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGISRuntime.Samples.ListTransformations.ListTransformations"
             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:ArcGISRuntime.Samples.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"
              HorizontalOptions="Center"
              WidthRequest="380">
            <Grid.RowDefinitions>
                <RowDefinition Height="50" />
                <RowDefinition Height="50" />
                <RowDefinition Height="140" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <StackLayout Grid.Row="0"
                         Margin="0,10"
                         Orientation="Horizontal">
                <Label x:Name="InSpatialRefTextBox" Margin="10,0,30,0" />
                <Label x:Name="OutSpatialRefTextBox" />
            </StackLayout>
            <StackLayout Grid.Row="1"
                         Margin="0,10"
                         Orientation="Horizontal">
                <Label Margin="10,0"
                       Text="Use extent"
                       VerticalOptions="Center" />
                <Switch x:Name="UseExtentSwitch"
                        IsToggled="False"
                        Toggled="UseExtentSwitch_Toggled"
                        VerticalOptions="Center" />
            </StackLayout>
            <ListView x:Name="TransformationsListBox"
                      Grid.Row="2"
                      HasUnevenRows="True"
                      HeightRequest="140"
                      ItemSelected="TransformationsListBox_ItemSelected"
                      ItemTemplate="{StaticResource TransformTemplateSelector}"
                      WidthRequest="340" />
            <Label x:Name="MessagesTextBox"
                   Grid.Row="3"
                   HeightRequest="80"
                   WidthRequest="340" />
        </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.