ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

修复几何

  • 描述
  • 使用
  • 语法
  • 代码示例
  • 环境
  • 许可信息

描述

检查要素类中每个要素的几何问题。发现几何问题后,将应用相关修复,并打印一行描述,以便识别要素并确定遇到的问题。

有效的输入为 shapefile、个人地理数据库要素类和文件地理数据库要素类。

了解有关检查和修复几何的详细信息

使用

    警告:

    此工具会修改输入数据。有关详细信息以及避免数据被意外更改的策略,请参阅不创建输出数据集的工具。

  • 此工具使用与检查几何工具相同的逻辑评估要素几何存在的问题。

  • 下面是所有几何问题和此工具将执行的相应修复的列表:

    • Null geometry - 从要素类中删除记录。要保留具有空几何的记录,请取消选中删除几何为空的要素(使用 Python 中有关 KEEP_NULL 参数的 delete_null 选项)。
    • Short segment - 删除几何的短线段。
    • Incorrect ring ordering - 更新几何以获得正确的环走向。
    • Incorrect segment orientation - 更新几何以获得正确的线段方向。
    • Self intersections - 融合面中的重叠区域。
    • Unclosed rings - 通过连接环的端点可将非闭合环闭合。
    • Empty parts - 删除 null 或空的部分。
    • Duplicate vertex - 删除其中一个折点。
    • Mismatched attributes - 更新 z 或 m 坐标以实现匹配。
    • Discontinuous parts - 根据现有的不连续部分创建多部分。
    • Empty Z values:将 z 的值设置为 0。
    • Bad envelope - 更新要素的包络矩形以实现更正。
  • 应用上述一种修复后,此工具将重新评估所得几何,如果发现了其他问题,将执行相关修复。例如,修复具有 Incorrect ring ordering 问题的几何结果可能会生成具有 Null geometry 问题的几何。

  • bad dataset extent 的修复几何中不存在修复。要解决这一问题,请运行数据集上的添加空间索引工具。

  • 在要素上传到数据库后,企业级地理数据库将自动检查并修复要素几何,因此不必将检查几何和修复几何工具用于企业级要素类。

语法

RepairGeometry(in_features, {delete_null})
参数说明数据类型
in_features

将修复的要素类或图层。有效的输入要素为 shapefile、个人地理数据库要素类和文件地理数据库要素类。

Feature Layer
delete_null
(可选)

指定要在空几何上执行的操作。

  • DELETE_NULL — 从输入中删除具有“空”几何的要素。这是默认设置。
  • KEEP_NULL — 不从输入中删除具有“空”几何的要素。
Boolean

派生输出

名称说明数据类型
out_feature_class

已更新的输入要素。

要素图层

代码示例

RepairGeometry 示例 1(Python 窗口)

以下 Python 窗口脚本演示了如何在即时模式下使用 RepairGeometry 函数。

import arcpy
arcpy.RepairGeometry_management("c:/data/sketchy.shp")
RepairGeometry 示例 2(独立脚本)

以下独立脚本是如何在脚本中应用 RepairGeometry 函数的示例。

# 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:
        fcs.append(row[0])
 
# 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):
        arcpy.Delete_management(lyr)
    
    tv = "cg_table_view"
    if arcpy.Exists(tv):
        arcpy.Delete_management(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))
    arcpy.RepairGeometry_management(lyr)

环境

  • 当前工作空间
  • 范围

许可信息

  • Basic: 是
  • Standard: 是
  • Advanced: 是

相关主题

  • 要素工具集概述
  • 检查和修复几何

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2019 Esri. | 隐私政策 | 法律声明