Check Geometry (Data Management)

License Level:BasicStandardAdvanced

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. SDE 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 SDE.

For additional information on geometry problems, its impact on the software, and potential sources, see Checking and repairing geometries.

Usage

Syntax

CheckGeometry_management (in_features, out_table)
ParameterExplanationData Type
in_features
[in_features,...]

One or more feature classes or feature layers that will be checked for geometry problems. Valid input formats are shapefile and feature classes stored in a personal geodatabase or file geodatabase.

Feature Layer
out_table

The table that will contain the list of problems that were discovered in the input features.

Table

Code Sample

Check Geometry Example (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"], "CG_Result")
Check Geometry Example 2 (Stand-alone Script)

The following stand-alone script uses the CheckGeometry function as 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.
# Requirements: Python

# Import modules
import arcpy
 
# The workspace in which the feature classes will be checked
outTable = "C:/data/St_Lucia.gdb/checkGeometryResult"
arcpy.env.workspace = "C:/data/St_Lucia.gdb"
 
# A variable that will hold the list of all the feature classes 
# inside the geodatabase
fcs = []
 
# List all feature classes in feature datasets
for fds in arcpy.ListDatasets("","featuredataset"):
    fcs += arcpy.ListFeatureClasses("*","",fds)
          
# List all standalone feature classes
fcs = arcpy.ListFeatureClasses()
     
print "Running the check geometry tool on %i feature classes" % len(fcs)
arcpy.CheckGeometry_management(fcs, outTable)

print (str(arcpy.GetCount_management(outTable)) + " geometry problems were found.")
print ("See " + outTable + " for full details")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015