Repair Geometry (Data Management)


Inspects each feature in a feature class for problems with its geometry. Upon discovery of a problem, a fix will be applied, and a one-line description will be printed identifying the feature, as well as the geometry problem that was fixed.

Learn more about checking and repairing geometries



    This tool modifies the input data. See Tools that do not create output datasets for more information and strategies to avoid undesired data changes.

  • This tool uses the same logic as the Check Geometry tool to identify geometry problems.

  • Below is the list of geometry problems and the corresponding fix that will be performed by the tool:

    • Null geometry—The record will be deleted from the feature class. To keep records with null geometry, uncheck Delete Features with Null Geometry (use the KEEP_NULL option on the delete_null parameter in Python).
    • Short segment—The geometry's short segment will be deleted.
    • Incorrect ring ordering—The geometry will be updated to have the correct ring ordering.
    • Incorrect segment orientation—The geometry will be updated to have the correct segment orientation.
    • Self intersections—The areas of overlap in a polygon will be dissolved.
    • Unclosed rings—The unclosed rings will be closed by connecting the end points of the rings.
    • Empty parts—The parts that are null or empty will be deleted.
    • Duplicate vertex—One of the vertices will be deleted.
    • Mismatched attributes—The z- or m-coordinate will be updated to match.
    • Discontinuous parts—Multiple parts will be created from the existing discontinuous part.
    • Empty Z values: The z-value will be set to 0.
    • Bad envelope—The feature's envelope will be updated to be correct.
  • After applying a fix, the tool will reevaluate the resulting geometry, and if another problem is discovered, the relevant fix will be performed for that problem. For example, the result of fixing a geometry with the Incorrect ring ordering problem may yield a geometry with the Null geometry problem.

  • There is no fix in Repair Geometry for bad dataset extent. To resolve this problem, run the Recalculate Feature Class Extent tool on the dataset.

  • The Esri validation method ensures geometry is topologically legal using the Esri Simplify method.

  • The OGC validation method ensures geometry complies with the OGC specification as defined in OpenGIS Implementation Standard for Geographic information – simple feature access – Part 1: common architecture.

  • After a feature's geometry is repaired using the OGC option, any subsequent edit or modification may cause the geometry to no longer comply with the OGC specification. After feature modification, run the Check Geometry tool to check for new geometry issues. If necessary, rerun the Repair Geometry tool.

  • OGC simplify does not support nonlinear segments such as Bézier curves, circular arcs, and elliptic arcs. These types of segments will have to be densified using the Densify tool on the input dataset before running Repair Geometry. To avoid irreversibly changing nonlinear segments when running the Densify tool, make a copy of the data first, then use Repair Geometry on the copy. To determine if your data has nonlinear segments, use the Add Geometry Attributes tool.


RepairGeometry(in_features, {delete_null}, {validation_method})
ParameterExplanationData Type

The feature class or layer to be processed.

Feature Layer

Specifies what action to take on null geometries.

  • DELETE_NULL Features that have NULL geometry will be deleted from the input. This is the default.
  • KEEP_NULL Features that have NULL geometry will not be deleted from the input.

Specifies which geometry validation method will be used to identify geometry problems.

  • ESRI Esri geometry validation method will be used. This is the default.
  • OGC Open Geospatial Consortium (OGC) geometry validation method will be used.

Derived Output

NameExplanationData Type

The updated input features.

Feature Layer

Code sample

RepairGeometry example 1 (Python window)

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

import arcpy
RepairGeometry example 2 (stand-alone script)

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

# Description: 
#   Goes through the table generated by the Check Geometry tool and does 
#   the following
#   1) backs-up all features which will be 'fixed' to a "_bad_geom" feature class
#   2) runs repairGeometry on all feature classes listed in the table 

import arcpy
import os
# Table that was produced by Check Geometry tool
table = r"c:\temp\data.gdb\cg_sample1"
# Create local variables
fcs = []
# Loop through the table and get the list of fcs
for row in arcpy.da.SearchCursor(table, ("CLASS")):
    # Get the class (feature class) from the cursor
    if not row[0] in fcs:
# Now loop through the fcs list, backup the bad geometries into fc + "_bad_geom"
# then repair the fc
print("> Processing {0} feature classes".format(len(fcs)))
for fc in fcs:
    print("Processing " + fc)
    lyr = 'temporary_layer'
    if arcpy.Exists(lyr):
    tv = "cg_table_view"
    if arcpy.Exists(tv):

    arcpy.MakeTableView_management(table, tv, ("\"CLASS\" = '%s'" % fc))
    arcpy.MakeFeatureLayer_management(fc, lyr)
    arcpy.AddJoin_management(lyr, arcpy.Describe(lyr).OIDFieldName, tv, "FEATURE_ID")
    arcpy.CopyFeatures_management(lyr, fc + "_bad_geom")
    arcpy.RemoveJoin_management(lyr, os.path.basename(table))

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics