Resumen
Repairs geometry errors or generates a report with problems found for manual review.
Uso
Valid input formats are shapefile and feature classes stored in a personal geodatabase or file geodatabase.
To facilitate the review of the features that are reported to have geometry problems, you can join the Input Feature Layers 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.
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.
Below is a table that explains the types of problems for which this tool evaluates a given set of features, details about each of the geometry problems, and the corresponding fix that will be performed by the tool when a problem is encountered.
Problem Check Repair Short segment
Some segments are shorter than allowed by the system units of the spatial reference associated with the geometry.
The geometry's short segment will be deleted.
Null geometry
The feature has no geometry or nothing in the SHAPE field.
The record will be deleted from the feature class if the DELETE_NULL_GEOMETRY option is used.
Incorrect ring ordering
The polygon is topographically simple, but its rings may not be oriented correctly (outer rings—clockwise; inner rings—counterclockwise).
The geometry will be updated to have the correct ring ordering.
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.
The geometry will be updated to have the correct segment orientation.
Self-intersections
A polygon must not intersect itself.
The areas of overlap in a polygon will be dissolved. The segments that intersect are split at their intersection.
Unclosed rings
The last segment in a ring must have its to point incident on the from point of the first segment.
The unclosed rings will be closed by connecting the ring's endpoints.
Empty parts
The geometry has multiple parts and one of them is empty (has no geometry).
The parts that are null, or empty, will be deleted.
Duplicate vertex
The geometry has two or more vertices with identical coordinates.
One of the vertices will be deleted.
Mismatched attributes
The Z or M coordinate of a line's segment endpoint does not match the Z or M coordinate of the coincident endpoint on the next segment.
The Z or M coordinate will be updated to match.
Discontinuous parts
One of the geometry's parts is made up of disconnected or discontinuous parts.
Multiple parts will be created from the existing discontinuous part.
Empty Z values
The geometry has one or more vertices with an empty Z value (NaN, for example).
The Z value will be set to 0.
Bad envelope
The envelope does not match the coordinate extent of the geometry.
The feature's envelope will be updated to be correct.
Bad dataset extent
The extent of the dataset does not contain all features.
There is no fix in Repair Geometry for the bad dataset extent problem. To resolve this problem, run the Add Spatial Index tool on the dataset.
Not simple
Polygon or polyline is not a simple feature.
Changes nonsimple geometry to be topologically legal by simplifying based on geometry type.
Negative area
Outer ring delineation of a polygon is a negative value.
The area of the feature will turn from negative to positive.
Endpoints not equal
The endpoints of a polygon share the same X and Y values, but not Z.
The Z values will be compared. Either the highest positive value or the lowest negative value will be retained.
Sintaxis
RepairBadGeometry(in_feature_layers, {only_report_errors}, {delete_null_geometry}, {output_table})
Parámetro | Explicación | Tipo de datos |
in_feature_layers [in_feature_layers,...] | The feature class or layer that will be repaired. This tool supports personal geodatabases, file geodatabases, and shapefiles. | Feature Layer |
only_report_errors (Opcional) | Specifies whether to generate a report or to repair the discovered errors.
| Boolean |
delete_null_geometry (Opcional) | Specifies what action to take on null geometries.
| Boolean |
output_table (Opcional) | The output table containing geometry problems discovered in the input features. | Table |
Muestra de código
RepairBadGeometry example 1 (stand-alone script)
The following stand-alone script demonstrates how to execute the RepairBadGeometry tool to generate a report of geometries that will be fixed if the tool is applied.
# Name: RepairBadGeometryExample_2.py
# Description: Reports or Repairs Geometry Errors
# Author: Esri
# Date: March 2015
# Import arcpy module
import arcpy
# Import toolbox
arcpy.ImportToolbox(r'C:\Program Files (x86)\ArcGIS\EsriProductionMapping\Desktop10.3\ArcToolbox\Toolboxes\Production Mapping Tools.tbx')
# Check out Production Mapping license
arcpy.CheckOutExtension("Foundation")
# Set environment
worksp = "C:\data\RepairBadGeometry.gdb"
# Define variables
inPoly1 = "C:\data\RepairBadGeometry.gdb\BuiltupA"
inPoly2 = "C:\data\RepairBadGeometry.gdb\TreeP"
inPoly3 = "C:\data\RepairBadGeometry.gdb\RoadL"
only_report_errors = "REPORT_ONLY"
output_table = "C:\data\RepairBadGeometry.gdb\RepairBadGeometryResults"
# Create feature layer for input features
arcpy.MakeFeatureLayer_management(inPoly1,"inBuiltupLyr")
arcpy.MakeFeatureLayer_management(inPoly2,"inTreeLyr")
arcpy.MakeFeatureLayer_management(inPoly3,"inRoadLyr")
# Repair Bad Geometry
arcpy.RepairBadGeometry_production("inBuiltupLyr;inTreeLyr;inRoadLyr", only_report_errors, "#", output_table)
# Check in Production Mapping license
arcpy.CheckInExtension("Foundation")
RepairBadGeometry example 2 (stand-alone script)
The following stand-alone script demonstrates how to execute the RepairBadGeometry tool and fix the geometries that are found to have irregularities.
# Name: RepairBadGeometryExample_1.py
# Description: Reports or Repairs Geometry Errors
# Author: Esri
# Date: March 2015
# Import arcpy module
import arcpy
# Import toolbox
arcpy.ImportToolbox(r'C:\Program Files (x86)\ArcGIS\EsriProductionMapping\Desktop10.3\ArcToolbox\Toolboxes\Production Mapping Tools.tbx')
# Check out Production Mapping license
arcpy.CheckOutExtension("Foundation")
# Set environment
worksp = "C:\data\RepairBadGeometry.gdb"
# Define variables
inPoly1 = "C:\data\RepairBadGeometry.gdb\BuiltupA"
inPoly2 = "C:\data\RepairBadGeometry.gdb\TreeP"
inPoly3 = "C:\data\RepairBadGeometry.gdb\RoadL"
only_report_errors = "REPAIR_ONLY"
delete_null_geometry = "DELETE_NULL_GEOMETRY"
output_table = "#"
# Create feature layer for input features
arcpy.MakeFeatureLayer_management(inPoly1,"inBuiltupLyr")
arcpy.MakeFeatureLayer_management(inPoly2,"inTreeLyr")
arcpy.MakeFeatureLayer_management(inPoly3,"inRoadLyr")
# Repair Bad Geometry
arcpy.RepairBadGeometry_production("inBuiltupLyr;inTreeLyr;inRoadLyr", only_report_errors, delete_null_geometry, output_table)
# Check in Production Mapping license
arcpy.CheckInExtension("Foundation")
Entornos
Información sobre licencias
- ArcGIS Desktop Basic: No
- ArcGIS Desktop Standard: Requiere Production Mapping
- ArcGIS Desktop Advanced: Requiere Production Mapping