Zusammenfassung
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.
Verwendung
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
Syntax
arcpy.defense.GeodatabaseCompare(Base_Geodatabase, Test_Geodatabase, Sort_Field, Compare_Type, Output_File, {Ignore_Options}, {Continue_Compare}, {Errors_Only})
Parameter | Erklärung | Datentyp |
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.
| 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,...] (optional) | Instructs the tool to ignore specified properties during comparison.
| String |
Continue_Compare (optional) | Indicates whether to compare all properties after encountering the first mismatch.
| Boolean |
Errors_Only (optional) | Indicates whether to write all results or only error results to the Output_File.
| Boolean |
Codebeispiel
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))
Umgebungen
Lizenzinformationen
- Basic: Nein
- Standard: Erfordert Defense Mapping
- Advanced: Erfordert Defense Mapping