# Calculate Transformation Errors

## Summary

Calculates residue errors and root mean square error (RMSE) based on the coordinates of the input links between known control points to be used for spatial data transformation.

## Usage

• This tool is used prior to the Transform Features tool to determine if the control points are good enough for the intended transformation, especially before you transform a large number of features.

• Input link features are lines representing transformation links between corresponding control points.

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

• Errors are calculated for one of the three transformation methods: affine, similarity, and projective. Each method requires a minimum number of transformation links. See About spatial adjustment transformations for more details, including transformation formulas.

• AFFINE—Affine transformation requires a minimum of three transformation links.
• PROJECTIVE—Projective transformation requires a minimum of four transformation links.
• SIMILARITY—Similarity transformation requires a minimum of two transformation links.
• The transformation result depends on the quality of your 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 are used to derive the parameters used in transformation equations, which are a best fit between the source and destination control points as described in About spatial adjustment transformations. 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. The residual errors for input links are written to the specified output table that contains the following fields:

• Orig_FID: The input link feature ID
• X_Source: The x coordinate of the source or from end location of the link
• Y_Source: The y coordinate of the source or from end location of the link
• X_Destination: The x coordinate of the destination or to end location of the link
• Y_Destination: The y coordinate of the destination or to 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 in general how good the derived transformation is. The RMSE value is written out in the processing messages. It is also a derived output parameter which you can use in a script or model workflow.

## Syntax

`CalculateTransformationErrors_edit (in_link_features, {out_link_table}, {method})`

## Code sample

CalculateTransformationErrors example 1 (Python window)

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

``````import arcpy
arcpy.env.workspace = "C:/data/Countries.gdb"
CalculateTransformationErrors example 2 (stand-alone script)

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

``````import arcpy
import os

# all input data are in country.gdb and output will also go to this gdb
arcpy.env.workspace = os.path.join(os.getcwd(), "country.gdb")

try:

# transformation method
method = "SIMILARITY"

# get the transformation error
error = float(result.getOutput(1))

# if error is less than 12.234 then run Transform Features
if error < 20.0:
# make a copy of the input features
else:
print("Transformation error {} is too high".format(error))

except arcpy.ExecuteError as aex:
print(arcpy.GetMessages(2))

except Exception as ex:
print(ex.args[0])``````

## Licensing information

• ArcGIS Desktop Basic: No
• ArcGIS Desktop Standard: No