Create Cross-Reference Geodatabase (Topographic Production)

Summary

Creates a cross-reference geodatabase that the Load Data tool uses to map source data to target data when loading batch data.

Usage

  • The Output Database parameter value can be used as the input cross-reference geodatabase in the Load Data tool.

  • The Source Workspace parameter value can be a geodatabase or shapefile.

  • The Target Database parameter value must be a geodatabase.

  • This tool will create a file geodatabase containing the tables and records required for transforming and loading the Source Workspace parameter value into the Target Database parameter value.

    Learn more about the cross-reference database

  • When the schema of the Source Workspace and Target Database parameter values don't match, the mapping file can be used to define how the features are mapped.

  • The Mapping File Excel spreadsheet requires a specific format. The template is included in the Production Mapping product files for use when defining a custom mapping file.

  • If no Mapping File parameter value is specified, the cross-reference geodatabase will contain mappings between all feature classes and fields that have the same name.

  • This tool will provide warnings when mappings cannot be created in the cross-reference geodatabase for the following scenarios:

    • An object class (feature class, shapefile, or table) in the source cannot be mapped to an object class in the target.
    • A field in a source object class cannot be mapped to a field in the target object class.
    • An object class in the target doesn't have a source object class mapped to it.
    • A field in a target object class exists but there is no field in the source object class mapped to it.
    • An object class is listed in the Mapping File parameter value that doesn't exist in the Source Workspace or Target Database parameter values.
    • A field is listed in the Mapping File parameter value that doesn't exist in the source or target object class.
    • The field type of a source field doesn't match the field type of a target field and no value mapping is provided.

Parameters

LabelExplanationData Type
Source Workspace

The workspace, either a geodatabase or shapefile directory, that contains the schema of data that will be mapped to the target workspace.

Shapefile; Workspace
Target Database

The geodatabase that contains the schema of the database to which the source will be mapped.

Workspace
Output Database

The file geodatabase that will be created containing the mapping from the Source Workspace parameter value to the Target Database parameter value.

Workspace
Mapping File
(Optional)

An Excel spreadsheet that contains information on how the source features, fields, and attribute value will be mapped to the Target Database parameter value.

File

arcpy.topographic.CreateCrossReferenceGeodatabase(source_workspace, target_database, out_database, {mapping_file})
NameExplanationData Type
source_workspace

The workspace, either a geodatabase or shapefile directory, that contains the schema of data that will be mapped to the target workspace.

Shapefile; Workspace
target_database

The geodatabase that contains the schema of the database to which the source will be mapped.

Workspace
out_database

The file geodatabase that will be created containing the mapping from the source_workspace parameter value to the target_database parameter value.

Workspace
mapping_file
(Optional)

An Excel spreadsheet that contains information on how the source features, fields, and attribute value will be mapped to the target_database parameter value.

File

Code sample

CreateCrossReferenceGeodatabase example (stand-alone script)

The following code sample demonstrates how to use the Create Cross-Reference Geodatabase function.

# Name: CreateCrossReferenceGeodatabase_sample.py
# Description: Creates cross-reference geodatabases that the Load Data tool uses
# to map source data to target data.

# Import System Modules
import arcpy

# Check Out Extensions
arcpy.CheckOutExtension('Foundation')

# Setting Local Variables
source_workspace = r'C:\Data\Source_Shapefiles'
target_database = r'C:\Data\Target_MGCP_TRD_4_6.gdb'
out_database = r'C:\Data\MGCP_TRD_4_5_1_SHP_to_MGCP_TRD_4_6_GDB.gdb'
mapping_file = r'C:\Data\MGCP_TRD_4_5_1_SHP_to_MGCP_TRD_4_6_GDB.xls'

# Use the Create Cross-Reference Geodatabase GP tool to load source shapefiles to MGCP_TRD_4_6.gdb
arcpy.topographic.CreateCrossReferenceGeodatabase(source_workspace, target_database, out_database, mapping_file)

# Check In Extensions
arcpy.CheckInExtension('Foundation')

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Requires Production Mapping
  • Advanced: Requires Production Mapping

Related topics