# BatchCheckGeometry.py
# Description: Loop through all the feature classes in a geodatabase, and
# generate 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
# in 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.management.CheckGeometry(fc_list, out_table)
print("{} geometry problems found, see {} for details.".format(
arcpy.management.GetCount(out_table)[0], out_table))