Geodatabase Compare (Defense Mapping)

License Level:BasicStandardAdvanced

Summary

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.

Usage

Syntax

GeodatabaseCompare_defense (Base_Geodatabase, Test_Geodatabase, Sort_Field, Compare_Type, Output_File, {Ignore_Options}, {Continue_Compare}, {Errors_Only})
ParameterExplanationData Type
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.

  • ALLAll properties of the feature classes will be compared. This is the default.
  • GEOMETRY_ONLYOnly the geometries of the feature classes will be compared.
  • ATTRIBUTES_ONLYOnly the attributes and their values will be compared.
  • SCHEMA_ONLYOnly the schema of the feature classes will be compared.
  • SPATIAL_REFERENCE_ONLYOnly 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,...]
(Optional)

Instructs the tool to ignore specified properties during comparison.

  • IGNORE_MDo not compare measure properties.
  • IGNORE_ZDo not compare elevation properties.
  • IGNORE_POINTIDDo not compare point id properties.
  • IGNORE_EXTENSION_PROPERTIESDo not compare extension properties.
  • IGNORE_SUBTYPESDo not compare subtypes.
  • IGNORE_RELATIONSHIPCLASSESDo not compare relationship classes.
  • IGNORE_REPRESENTATIONCLASSESDo not compare representation classes.
String
Continue_Compare
(Optional)

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

  • NO_CONTINUE_COMPAREStops after encountering the first mismatch. This is the default.
  • CONTINUE_COMPARECompares other properties after encountering the first mismatch.
Boolean
Errors_Only
(Optional)

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

  • NOT_ERRORS_ONLYWrite all comparison results to the Output File. This is the default.
  • ERRORS_ONLYWrite only comparison error results to Output_File.
Boolean

Code Sample

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: Esri 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))

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: Requires Defense Mapping
ArcGIS for Desktop Advanced: Requires Defense Mapping
9/2/2013