Summary
Generates a report of the geometry problems in a feature class.
Valid input formats are shapefile and feature classes stored in a personal geodatabase or file geodatabase. Enterprise geodatabases automatically check the validity of each geometry when they are uploaded; therefore, the Check Geometry and Repair Geometry tools are not for use with Enterprise geodatabases.
For additional information on geometry problems, its impact on the software, and potential sources, see Checking and repairing geometries.
Usage
The Output Table will have a record for each geometry problem discovered. If no problems are found, the table will be empty.
The Output Table has the following fields:
- CLASS—The full path to and name of the feature class in which the problem was found.
- FEATURE_ID—The Feature ID (FID) or Object ID (OID) for the feature with the geometry problem.
- PROBLEM—A short description of the problem.
The PROBLEM field will contain one of the following:
- Short segment—Some segments are shorter than allowed by the system units of the spatial reference associated with the geometry.
- Null geometry—The feature has no geometry or nothing in the SHAPE field.
- Incorrect ring ordering—The polygon is topologically simple, but its rings may not be oriented correctly (outer rings clockwise; inner rings counterclockwise).
- Incorrect segment orientation—Individual segments are not consistently oriented. The to point of segment i should be incident on the from point of segment i+1.
- Self intersections—A polygon must not intersect itself.
- Unclosed rings—The last segment in a ring must have its to point incident on the from point of the first segment.
- Empty parts—The geometry has multiple parts and one of them is empty (has no geometry).
- Duplicate vertex—The geometry has two or more vertices with identical coordinates.
- Mismatched attributes—The z- or m-coordinate of a line segment's endpoint does not match the z- or m-coordinate of the coincident endpoint on the next segment.
- Discontinuous parts—One of the geometry's parts is made up of disconnected or discontinuous parts.
- Empty Z values—The geometry has one or more vertices with an empty z-value (NaN, for example).
- Bad envelope—The envelope does not match the coordinate extent of the geometry.
- Bad dataset extent—The extent of the dataset does not contain all features.
The problem identified by this tool can be addressed in the following ways:
- Manually edit and fix the feature with the geometry problems. Some of the problems cannot be fixed through editing.
- Run the Repair Geometry tool on the feature classes that were identified as having geometry problems.
For point features, only the null geometry problem is possible.
To facilitate the review of the features that are reported to have geometry problems, you can join the Input Features to the Output Table using the Add Join tool, along with the input's OBJECTID or FID field and the output table's FEATURE_ID field.
Syntax
arcpy.management.CheckGeometry(in_features, out_table)
Parameter | Explanation | Data Type |
in_features [in_feature,...] | One or more feature classes or feature layers to check for geometry problems. Valid inputs are shapefile and feature classes stored in a personal geodatabase or file geodatabase. | Feature Layer |
out_table | The output table containing geometry problems discovered in the input features. | Table |
Code sample
CheckGeometry example 1 (Python window)
The following Python window script demonstrates how to use the CheckGeometry function in immediate mode.
import arcpy
arcpy.env.workspace = "c:/data/data.gdb"
arcpy.CheckGeometry_management(["contours", "roads", "vegetation"], "CheckGeom_Result")
CheckGeometry example 2 (stand-alone script)
The following stand-alone script uses the CheckGeometry function by looping through all the feature classes in a geodatabase.
# BatchCheckGeometry.py
# Description:
# Loops through all the feature classes in a geodatabase, and generates
# a report of the problems encountered with feature geometry.
# Import modules
import arcpy
import os
# The geodatabase in which the feature classes will be checked
arcpy.env.workspace = "C:\\data\\St_Lucia.gdb"
out_table = "checkGeometryResult"
# A variable that will hold the list of all the feature classes
# inside the geodatabase
fc_list = []
# Identify all feature classes in the geodatabase
for path, dirnames, fcs in arcpy.da.Walk(arcpy.env.workspace,
datatype='FeatureClass'):
for fc in fcs:
fc_list.append(os.path.join(path, fc))
print("Running the check geometry tool on {} feature classes".format(
len(fc_list)))
arcpy.CheckGeometry_management(fc_list, out_table)
print("{} geometry problems found, see {} for details.".format(
arcpy.GetCount_management(out_table)[0], out_table))
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes