Transform Features (Editing)

Summary

Converts the coordinates of input features from one location to another through scaling, shifting, and rotating based on the transformation links between known corresponding control points.

Usage

    Caution:

    This tool modifies the input data. See Tools that modify or update the input data for more information and strategies to avoid undesired data changes.

    Note:

    All inputs must be in the same coordinate system.

  • Input features can be points, lines, polygons. or annotations.

  • Input link features are lines representing transformation links between known corresponding control points. The starting point of a link is the source control point location and the endpoint of the link is the corresponding target control point location.

  • The transformation works in a Cartesian or planar coordinate system. A projected coordinate system (PCS) is recommended. Using a geographic coordinate system (GCS) with values in latitude and longitude may result in distortion or cause calculation errors.

  • All input features are transformed by one of the three transformation methods: affine, similarity, and projective. Each method requires a minimum number of transformation links. See Transform a feature for details, including transformation formulas.

    • AFFINE—Requires a minimum of three transformation links
    • PROJECTIVE—Requires a minimum of four transformation links
    • SIMILARITY—Requires a minimum of two transformation links
  • The transformed result depends on the quality of the input links. A link should start from a known source location and end at its corresponding destination location, also called control points. The better established the control points, the more accurate the transformed result. The coordinates of the from and to locations of the links will be used to derive the transformation parameters, which are a best fit between the source and destination control points. Even if you use the transformation parameters to transform the actual source control points, the resulting locations won't match the destination control point locations. This is called the residual error and it is generated for each transformation link. As an option, the residual errors for input links can be written out to a table that contains the following fields:

    • Orig_FID—The input link feature ID
    • X_Source—The x-coordinate of the source or from the end location of the link
    • Y_Source—The y-coordinate of the source or from the end location of the link
    • X_Destination—The x-coordinate of the destination or to the end location of the link
    • Y_Destination—The y-coordinate of the destination or to the end location of the link
    • Residual_Error—The residual error of the transformed location

    A root mean square error (RMSE), also known as root mean square deviation (RMSD), is calculated based on the residual errors and indicates the general suitability of the derived transformation. The RMSE value is written out in the processing messages. It is also a derived output parameter that you can use in a script or model workflow.

    The Transform features topic provides details regarding the calculations of residual errors and RMSE. You must determine the acceptable RMSE value based on your knowledge of the positional accuracy of the input features as well as the control points. If the RMSE value is too high, review the residual errors and discard or replace the links that have high residual errors.

Parameters

LabelExplanationData Type
Input Features

The input features, the coordinates of which will be transformed. They can be points, lines, polygons, or annotations.

Feature Layer
Input Link Features

The input link features that link known control points for the transformation.

Feature Layer
Method
(Optional)

Specifies the transformation method that will be used to convert input feature coordinates.

  • Affine transformationAa minimum of three transformation links is required. This is the default.
  • Projective transformationA minimum of four transformation links is required.
  • Similarity transformationA minimum of two transformation links is required.
String
Output Link Table
(Optional)

The output table containing the input links and their residual errors.

Table

Derived Output

LabelExplanationData Type
RMSE

Reports the root mean square error (RMSE) value.

Double
Updated Input Features

The updated input features.

Feature Layer

arcpy.management.TransformFeatures(in_features, in_link_features, {method}, {out_link_table})
NameExplanationData Type
in_features

The input features, the coordinates of which will be transformed. They can be points, lines, polygons, or annotations.

Feature Layer
in_link_features

The input link features that link known control points for the transformation.

Feature Layer
method
(Optional)

Specifies the transformation method that will be used to convert input feature coordinates.

  • AFFINEAa minimum of three transformation links is required. This is the default.
  • PROJECTIVEA minimum of four transformation links is required.
  • SIMILARITYA minimum of two transformation links is required.
String
out_link_table
(Optional)

The output table containing the input links and their residual errors.

Table

Derived Output

NameExplanationData Type
out_rmse

Reports the root mean square error (RMSE) value.

Double
out_feature_class

The updated input features.

Feature Layer

Code sample

TransformFeatures example 1 (Python window)

The following Python window script demonstrates how to use the TransformFeatures function in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.edit.TransformFeatures("source_Roads.shp","control_Links.shp",
                             "AFFINE")
TransformFeatures example 2 (stand-alone script)

The following stand-alone script is an example of how to apply the TransformFeatures function in a scripting environment.

import arcpy
import os

# Set environment settings
arcpy.env.overwriteOutput = True

# Function to convert link info in a text file to a line feature class
def CreateLinkFeatures(in_text_file, in_data):

    sr = arcpy.Describe(in_data).spatialReference
    features = []  # a list to hold polyline geometry objects

    f = open(in_text_file, "r")
    
    for line in f.readlines():

        # Take start/end blank spaces off
        # Separate the start and end point coordinates
        points = line.strip().split()   
        
        point1 = arcpy.Point(float(points[1]), float(points[2]))
        point2 = arcpy.Point(float(points[3]), float(points[4]))
        
        features.append(arcpy.Polyline(arcpy.Array([point1, point2]), sr))
        
    f.close()   # close the text file

    # Copy the geometry objects into a feature class named Links
    result = arcpy.management.CopyFeatures(features, in_data + "_links")

    return result[0]
    
if __name__ == "__main__":

    # Make a copy of the data because
    # TransformFeatures tool modifies the input data
    arcpy.management.CopyFeatures(r"C:\data\Tutorial.gdb\Parcels", r"C:\data\Tutorial.gdb\Parcels_copy")

    links_file = r"C:\data\TF_links.txt"
    tf_link_features = CreateLinkFeatures(links_file, r"C:\data\Tutorial.gdb\Parcels")
    
    arcpy.edit.TransformFeatures(r"C:\data\Tutorial.gdb\Parcels_copy", tf_link_features)
    print(arcpy.GetMessages())