修复几何 (数据管理)

修复几何 (数据管理)

arcpy.management.RepairGeometry(in_features, {delete_null}, {validation_method})名称说明数据类型in_features将处理的要素类或图层。

许可:Desktop Basic 许可仅允许存储在文件地理数据库、GeoPackage 或 SpatiaLite 数据库中的 shapefile 和要素类作为有效的输入要素格式。 Desktop Standard 或 Desktop Advanced 许可额外允许存储在企业级数据库或企业级地理数据库中的要素类作为有效的输入要素格式使用。

Feature Layerdelete_null(可选)指定是否删除几何为空的要素。

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

注:KEEP_NULL 仅对来自企业级数据库、企业级地理数据库、GeoPackage 或 SpatiaLite 数据库的输入有效。

Booleanvalidation_method(可选)指定用于识别几何问题的几何验证方法。

ESRI—将使用 Esri 几何验证方法。 这是默认设置。OGC—将使用 OGC 几何验证方法。String派生输出名称说明数据类型out_feature_class更新后的输入要素。

Feature Layer代码示例RepairGeometry 示例 1(Python 窗口)

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

import arcpy

arcpy.management.RepairGeometry("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)

你可能也喜欢

如何借用他人手机流量 如何借用他人手机流量的方法
造一艘船,到底要花多少钱?一文带你看懂船舶的“身价”构成!
申请电子邮件账号?怎么注册电子邮箱地址
365限制投注额度怎么办

申请电子邮件账号?怎么注册电子邮箱地址

📅 11-04 👀 9720
奢伴app最新版免费下载 1.3.7
365bet开户在线

奢伴app最新版免费下载 1.3.7

📅 08-16 👀 5062
[插件集成]Garmin Connect 中文版(佳明手表数据同步)
LOL前iG队长White或担任皇族战队中单
365bet开户在线

LOL前iG队长White或担任皇族战队中单

📅 07-15 👀 8395
酷乐视 X6旗舰版 投影机
365bet地址

酷乐视 X6旗舰版 投影机

📅 10-27 👀 6435
问多久做一次spa合适
365bet开户在线

问多久做一次spa合适

📅 09-09 👀 2141
佳作赏析
365bet地址

佳作赏析

📅 07-31 👀 1347