ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

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

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS Developers

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

ArcGIS Solutions

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

ArcGIS Marketplace

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

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

ArcMap

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

修复几何

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

描述

检查要素类中每个要素的几何问题。 如发现问题,将对其进行修复,并将通过一行描述识别要素及修复的几何问题。

此工具将使用与检查几何工具相同的逻辑来修复几何问题。

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

使用方法

    警告:

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

  • 此工具可修复以下几何问题:

    • Null geometry - 从要素类中删除记录。 要保留具有空几何的记录,请取消选中删除几何为空的要素参数(在 Python 中为 delete_null = "KEEP_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 问题。 要解决这一问题,请运行数据集上的重新计算要素类范围工具。

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

语法

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

将处理的要素类或图层。

Feature Layer
delete_null
(可选)

指定是否删除几何为空的要素。

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

派生输出

名称说明数据类型
out_feature_class

更新后的输入要素。

Feature Layer

代码示例

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
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

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