摘要
Repairs geometry errors or generates a report with problems found for manual review.
用法
Valid input formats are shapefile and feature classes stored in a personal geodatabase or a file geodatabase.
To review the features that have been reported to have geometry problems, you can join the Input Feature Layers 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 value's FEATURE_ID field.
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 following fields will be added to the Output Table parameter value:
- 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.
The following table describes the types of problems for which this tool evaluates a given set of features, details about each of the geometry problems, and the corresponding repair that will be performed by the tool when a problem is encountered:
Problem Details 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 the SHAPE field is empty.
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 with 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 with 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 will be 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 composed 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.
This tool and the Repair Geometry tool do not repair the bad dataset extent problem. To resolve this problem, run the Recalculate Feature Class Extent tool on the dataset, or run the Remove Spatial Index tool, followed by the Add Spatial Index tool.
Not simple
The polygon or polyline is not a simple feature.
Nonsimple geometry will be changed to be topologically correct by simplifying based on geometry type.
Negative area
The 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 and either the highest positive value or the lowest negative value will be retained.
语法
arcpy.production.RepairBadGeometry(in_feature_layers, {only_report_errors}, {delete_null_geometry}, {output_table})
参数 | 说明 | 数据类型 |
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 (可选) | Specifies whether a report will be generated or the errors will be repaired.
| Boolean |
delete_null_geometry (可选) | Specifies whether features with NULL geometry will be deleted.
| Boolean |
output_table (可选) | The output table containing the geometry problems found in the input features. | Table |
代码示例
RepairBadGeometry example 1 (stand-alone script)
The following stand-alone script demonstrates how to execute the RepairBadGeometry function 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 function and fix the geometries that are found to have errors.
# 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")
环境
许可信息
- ArcGIS Desktop Basic: 否
- ArcGIS Desktop Standard: 需要 Production Mapping
- ArcGIS Desktop Advanced: 需要 Production Mapping