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

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

Geodatabase Compare

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

描述

Compares feature classes and tables in a test geodatabase to those in a base geodatabase. This tool also performs an enhanced field comparison between objects in the base and test geodatabases. Results of the comparison are written to an output log file.

使用方法

  • This tool invokes Feature Compare and Table Compare for each matching set of dataset and table names found in the base and test geodatabases. The outputs from each execution of Feature Compare and Table Compare are appended to a single output file.

  • Base Geodatabase and Test Geodatabase do not have to be the same geodatabase type. However, field and data type differences between types may cause the tool to find miscompares. Coverage or shapefile workspaces are not supported.

  • This tool searches a list of dataset and table names from Test Geodatabase for each dataset and table name in Base Geodatabase. Enterprise geodatabases may contain duplicate dataset or table names that are owned by different user accounts. Object comparison between the geodatabases is done by dataset or table name only. If the connecting account for Test Geodatabase has access to duplicate dataset or table names, only the last–listed dataset or table name found will be compared to a matching item in Base Geodatabase. You can limit permissions in Test Geodatabase to control this.

  • Sort Field must exist in each feature class and table in both Base Geodatabase and Test Geodatabase. If it does not, the tool will return ERROR 00080: The value is not a member of <field list> and stop execution. Continue Compare will not affect this behavior.

  • Compare Type defaults to ALL. The ALL option includes spatial reference, field properties, attributes, and geometry.

  • If Compare Type is set to ALL or SCHEMA_ONLY, the tool performs enhanced field checking. Fields missing from either the base or test object are written to Output File.

  • If Compare Type is set to ALL or ATTRIBUTES_ONLY, the tool omits noneditable fields from execution. See the Omit Fields parameter of Feature Compare and Table Compare.

  • If set, the following Ignore Options are not used when comparing tables in Base Geodatabase and Test Geodatabase:

    • IGNORE_M
    • IGNORE_Z
    • IGNORE_POINTID
    • IGNORE_REPRESENTATIONCLASSES

语法

arcpy.defense.GeodatabaseCompare(Base_Geodatabase, Test_Geodatabase, Sort_Field, Compare_Type, Output_File, {Ignore_Options}, {Continue_Compare}, {Errors_Only})
参数说明数据类型
Base_Geodatabase

The Base Geodatabase contains feature classes and tables that you have declared valid. Items in the Test Geodatabase are compared to these feature classes and tables.

Workspace
Test_Geodatabase

Items in the Test Geodatabase are compared to those in the Base Geodatabase.

Workspace
Sort_Field
[Sort_Field,...]

The field or fields used to sort records in each object in the Base Geodatabase and Test Geodatabase. The records are sorted in ascending order. Sorting by a common field in both base and test objects ensures that you are comparing the same row from each input dataset. Separate multiple field names with a semicolon: OBJECTID;CNTRY_NAME.

String
Compare_Type

Indicates which feature class and table properties will be compared. Compare types GEOMETRY_ONLY and SPATIAL_REFERENCE_ONLY are ignored for tables.

  • ALL —All properties of the feature classes will be compared. This is the default.
  • GEOMETRY_ONLY —Only the geometries of the feature classes will be compared.
  • ATTRIBUTES_ONLY —Only the attributes and their values will be compared.
  • SCHEMA_ONLY —Only the schema of the feature classes will be compared.
  • SPATIAL_REFERENCE_ONLY —Only the spatial references of the two feature classes will be compared.
String
Output_File

Output file that will contain the comparison results between feature classes and tables in Base Geodatabase and Test Geodatabase. This includes a list of objects in one geodatabase but not the other. The output text file is comma delimited and can be used as a table in ArcGIS.

File
Ignore_Options
[Ignore_Options,...]
(可选)

Instructs the tool to ignore specified properties during comparison.

  • IGNORE_M —Do not compare measure properties.
  • IGNORE_Z —Do not compare elevation properties.
  • IGNORE_POINTID —Do not compare point id properties.
  • IGNORE_EXTENSION_PROPERTIES —Do not compare extension properties.
  • IGNORE_SUBTYPES —Do not compare subtypes.
  • IGNORE_RELATIONSHIPCLASSES —Do not compare relationship classes.
  • IGNORE_REPRESENTATIONCLASSES —Do not compare representation classes.
String
Continue_Compare
(可选)

Indicates whether to compare all properties after encountering the first mismatch.

  • NO_CONTINUE_COMPARE —Stops after encountering the first mismatch. This is the default.
  • CONTINUE_COMPARE —Compares other properties after encountering the first mismatch.
Boolean
Errors_Only
(可选)

Indicates whether to write all results or only error results to the Output_File.

  • NOT_ERRORS_ONLY —Write all comparison results to the Output File. This is the default.
  • ERRORS_ONLY —Write only comparison error results to Output_File.
Boolean

代码示例

GeodatabaseCompare example (Python window)

The following code demonstrates how to use the GeodatabaseCompare tool.

# Name: GeodatabaseCompare_Example.py
# Description: Compares feature classes and tables in base and test workspaces
# Requirements: ArcGIS Defense Mapping solution

import os

# set our current workspace
arcpy.env.workspace="c:/data"

# define the base and test workspaces
baseWorkspace="MGCP_TRD4.gdb"
testWorkspace="MGCP_TRD4_test.gdb"

# define a field to sort by
sortField="OBJECTID"

# define an output file - will be written to env.workspace
outFile="geodbCompareFile.txt"

# execute the Geodatabase compare tool
res = arcpy.GeodatabaseCompare_defense(baseWorkspace,testWorkspace,sortField,"ALL",outFile,"","CONTINUE_COMPARE","ERRORS_ONLY")

# check for the file
print os.path.exists(os.path.join(arcpy.env.workspace,outFile))

环境

  • 当前工作空间

许可信息

  • Basic: 否
  • Standard: 需要 Defense Mapping
  • Advanced: 需要 Defense Mapping

相关主题

  • An overview of the Validation toolset

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

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