Calculate Default XY Tolerance (Data Management)
Summary
Calculates a default XY tolerance by examining the spatial reference and the extent of the feature class.
With geodatabase feature classes, the value returned by this tool will be identical to the XY Tolerance property on a geodatabase feature class or dataset, or the cluster tolerance of a topology. With non-geodatabase feature classes such as coverage feature classes, shape files, or CAD feature classes, the value will be based on the default tolerance of the feature class' spatial reference.
![Legacy Legacy](rsrc/legacy.png)
The terms XY Tolerance and Cluster Tolerance are synonymous. You will see the usage of Cluster Tolerance in topology, python script, and ArcGIS prior to the 9.2 Release. The name of this tool (used in scripting) is CalculateDefaultClusterTolerance.
XY tolerance is also available in scripting through the XYTolerance property of a SpatialReference object. A SpatialReference object can be created by describing a feature class.
Usage
This tool cannot be used to reset the value of default XY Tolerance; it can only calculate the XY tolerance value.
The result of this tool will be returned as a message from the tool. The values can be viewed in the geoprocessing Results window, or the value can be assigned to a variable in scripting by accessing the tool execution result object.
-
Although the default XY tolerance of non-geodatabase feature classes maybe different depending on the spatial reference, its value is equivalent to 0.001 meter. This default value cannot be changed.
The XY tolerance of a geodatabase feature classes can be specified when a new feature class, or its containing feature dataset or topology, is created in a geodatabase. If you do not specify a new XY tolerance, the default values of the containing feature classes are used, which usually is equivalent to 0.001 meter. If the feature class is saved in a topology of a geodatabase, then XY tolerance can be reset using the Set Cluster Tolerance tool. For more information, you can right-click any feature class or dataset and click Properties, then select the Tolerance tab, then check About Setting Tolerance help.
-
Most tools that create new feature classes (such as Create Feature Class or Copy Features) honor the XY_Tolerance environment setting. However, only those tools that use this environment will set the XY tolerance on the output feature class. The input XY tolerance will not be affected by this environment setting.
Syntax
Parameter | Explanation | Data Type |
in_features |
The feature class for which the default XY tolerance will be calculated. | Feature Layer |
Code Sample
The following Python window script demonstrates how to use the Calculate Default Cluster Tolerance function in immediate mode.
import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.CalculateDefaultClusterTolerance_management("roads.shp")
The following Python window script demonstrates how to use the Calculate Default Cluster Tolerance function in a scripting environment.
# Name: CalculateDefaultClusterTolerance_Example.py
# Description: Calculate the default cluster tolerance of a shape file
# Author: ESRI
#Import the system modules
import arcpy
from arcpy import env
env.workspace = "C:/temp"
#Set local variables
shapefileName = "linefc.shp"
arcpy.CalculateDefaultClusterTolerance_management(shapefileName)