Check Geometry (Data Management)

Summary

Generates a report of geometry problems in a feature class.

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

Usage

  • Valid input formats are shapefiles, and feature classes stored in a file geodatabase, enterprise database or geodatabase, GeoPackage, or SpatiaLite database. For feature classes stored in an enterprise database or enterprise geodatabase, the following spatial types are supported:

    • Microsoft SQL Server—Geometry and Geography
    • PostgreSQLPostGIS, Geometry and Geography
    • Oracle—SDO_Geometry

    License:

    A Desktop Basic license allows you to apply this tool to only shapefiles and feature classes stored in a file geodatabase, GeoPackage, or SpatiaLite database. A Desktop Standard or Desktop Advanced license allows you to additionally apply this tool to feature classes stored in an enterprise database or geodatabase.

  • The Output Table parameter value will have a record for each geometry problem found. If no problems are found, the table will be empty.

  • The contents of the Output Table parameter value, including the PROBLEM field codes, are written in English.

  • For point features, only the null geometry problem is possible.

  • To review the features that are reported to have geometry problems, you can join the Input Features parameter value to the Output Table parameter value using the Add Join tool, along with the input's OBJECTID or FID field and the output table's FEATURE_ID field. If any of the Input Features parameter values are stored in an enterprise geodatabase or database, GeoPackage, or SpatiaLite database, the output table will also include a TEXT_ID field that is used for noninteger-based OBJECTID columns.

  • The Esri validation method ensures that geometry is topologically correct using the Esri Simplify method. Only the Esri validation is available for data stored in an enterprise geodatabase.

  • The Open Geospatial Consortium (OGC) validation method ensures that 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.

  • The problems 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.
    • Use the Repair Geometry tool. Some problems associated with data stored in enterprise databases or geodatabases, GeoPackages, and SpatiaLite databases may not be repairable with ArcGIS tools.
  • The Output Table parameter value 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.
    • TEXT_ID—This field only exists when Input Features values are stored in an enterprise database or geodatabase, GeoPackage or SpatiaLite database.
    • PROBLEM—A short description of the problem.
  • The PROBLEM field will contain one of the following codes:

    • 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 sequential 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 composed 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 property of the dataset does not contain all of the features in the dataset. For this problem, the FEATURE_ID value will be -1.

    For data stored in enterprise geodatabases, the PROBLEM field will contain one of the following codes:

    • NEEDS_REORDERING—The shape needs to be reordered or have duplicate points removed.
    • SE_INVALID_ENTITY_TYPE—Invalid entity type.
    • SE_SHAPE_INTEGRITY_ERROR—Shape integrity error.
    • SE_INVALID_SHAPE_OBJECT—The shape object handle is invalid.
    • SE_COORD_OUT_OF_BOUNDS—The specified coordinate exceeds the valid coordinate range.
    • SE_POLY_SHELLS_OVERLAP—Two donuts or two outer shells overlap.
    • SE_TOO_FEW_POINTS—The number of points is less than required for the feature.
    • SE_INVALID_PART_SEPARATOR—A part separator is in the wrong position.
    • SE_INVALID_POLYGON_CLOSURE—A polygon does not close properly.
    • SE_INVALID_OUTER_SHELL—A polygon outer shell does not completely enclose all donuts for the part.
    • SE_ZERO_AREA_POLYGON—A polygon shell has no area.
    • SE_POLYGON_HAS_VERTICAL_LINE—A polygon shell contains a vertical line.
    • SE_OUTER_SHELLS_OVERLAP—A multipart area has overlapping parts.
    • SE_SELF_INTERSECTING—A linestring or poly boundary is self-intersecting.

Parameters

LabelExplanationData Type
Input Features

One or more feature classes or feature layers to be checked for geometry problems.

License:

A Desktop Basic license only allows shapefiles and feature classes stored in a file geodatabase, GeoPackage, or SpatiaLite database as valid input feature formats. A Desktop Standard or Desktop Advanced license additionally allows feature classes stored in an enterprise database or geodatabase to be used as valid input feature formats.

Feature Layer
Output Table

The report (as a table) of the problems discovered.

Table
Validation Method
(Optional)

Specifies the geometry validation method that will be used to identify geometry problems.

  • EsriThe Esri geometry validation method will be used. This is the default.
  • OGCThe OGC geometry validation method will be used.
String

arcpy.management.CheckGeometry(in_features, out_table, {validation_method})
NameExplanationData Type
in_features
[in_features,...]

One or more feature classes or feature layers to be checked for geometry problems.

License:

A Desktop Basic license only allows shapefiles and feature classes stored in a file geodatabase, GeoPackage, or SpatiaLite database as valid input feature formats. A Desktop Standard or Desktop Advanced license additionally allows feature classes stored in an enterprise database or geodatabase to be used as valid input feature formats.

Feature Layer
out_table

The report (as a table) of the problems discovered.

Table
validation_method
(Optional)

Specifies the geometry validation method that will be used to identify geometry problems.

  • ESRIThe Esri geometry validation method will be used. This is the default.
  • OGCThe OGC geometry validation method will be used.
String

Code sample

CheckGeometry example 1 (Python window)

The following Python window script demonstrates how to use the CheckGeometry function in immediate mode in a file geodatabase.

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 file 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 
# 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.CheckGeometry_management(fc_list, out_table)

print("{} geometry problems found, see {} for details.".format(
    arcpy.GetCount_management(out_table)[0], out_table))

Licensing information

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

Related topics