Transforms by suitability

View on GitHub
Sample viewer app

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

Check the checkbox to order the list of transformations by suitability for the map extent, if desired. 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. 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

Offline data

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, click 'Download APIs and SDKs'.
  3. Click the download button next to 'ArcGISRuntimeCoordinateSystemData' to download projection engine data to your computer.
  4. Unzip the downloaded data on your computer.
  5. Create an ArcGIS/samples/PEData directory on your device and copy the files to this directory.

You can use the Android Debug Bridge (adb) tool found in /platform-tools to copy files to your device:

  1. Open a command prompt on your computer.
  2. Execute the adb push command to create the ArcGIS/samples/PEData directory and copy the files from your computer to the device:

    • adb push <path to PEData directory on your computer> /sdcard/ArcGIS/samples/PEData

You should now have the following directory containing projection engine data files on your target device:

  • /sdcard/ArcGIS/samples/PEData

    Offline Data

  • To use the Projection Engine in ArcGIS Runtime, extra resources are required. Download the data Projection Engine Data from ArcGIS for Developers.
  • Extract the contents of the downloaded zip file to disk.
  • Open your command prompt and navigate to the folder where you extracted the contents of the data from step 2.
  • Push the data into the scoped storage of the sample app: adb push PEDataRuntime /Android/data/com.esri.arcgisruntime.sample.transformsbysuitability/files/PEDataRuntime

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.

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.


datum, geodesy, projection, spatial reference, transformation

Sample Code
/* Copyright 2017 Esri
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.

package com.esri.arcgisruntime.sample.transformsbysuitability;

import java.util.ArrayList;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.esri.arcgisruntime.geometry.DatumTransformation;
import com.esri.arcgisruntime.geometry.GeographicTransformation;
import com.esri.arcgisruntime.geometry.GeographicTransformationStep;

 * Adapter that takes an ArrayList of DatumTransformations and shows the name of each transformation, and details
 * of missing grid files, if any.
public class DatumTransformationAdapter extends ArrayAdapter<DatumTransformation> {

  private DatumTransformation defaultValue;

  public DatumTransformationAdapter(Context context, ArrayList<DatumTransformation> transformations) {
    super(context, 0, transformations);

   * When default transformation is set, the default transformation will be shown in the list with a Bold font.
   * @param defaultTransformation the default transformation
  public void setDefaultTransformation(DatumTransformation defaultTransformation) {
    defaultValue = defaultTransformation;

  public View getView(int position, View convertView, ViewGroup parent) {
    // Check if an existing view is being reused, otherwise inflate the view
    if (convertView == null) {
      convertView = LayoutInflater.from(getContext()).inflate(R.layout.custom_list_item,
          parent, false);

    // Lookup TextViews in this list item for displaying transform information
    TextView tvName = convertView.findViewById(;
    TextView tvFiles = convertView.findViewById(;

    // Get the data item for this position
    DatumTransformation transformation = getItem(position);

    // Set the name of the transformation into the first TextView

    StringBuilder sb = new StringBuilder();

    // Look for unusable transformations
    if (transformation.isMissingProjectionEngineFiles()) {

      if (transformation instanceof GeographicTransformation) {
        GeographicTransformation gt = (GeographicTransformation)transformation;

        // Get the names of missing grid files from the steps in this transformation.
        // If there are multiple steps, one or more may report missing grid files
        for (GeographicTransformationStep step : gt.getSteps()) {
          if (step.isMissingProjectionEngineFiles()) {
            // Add missing files to the list to be reported to the user
            sb.append(": " );
            sb.append(TextUtils.join(", ", step.getProjectionEngineFilenames()));

      // List items for transformations with missing grid files appear different in the UI.

    // If the default transformation is set, then highlight the default transformation in the list
    // by setting the font to Bold.
    if ((defaultValue != null) && (defaultValue.equals(transformation) )) {
      tvName.setTypeface(null, Typeface.BOLD);
    } else {
      tvName.setTypeface(null, Typeface.NORMAL);

    // Update the second TextView to indicate if there are missing grid files or not.

    // Return the completed view to render on screen
    return convertView;