Load Data (Production Mapping)

License Level:BasicStandardAdvanced

Summary

Moves features from one schema to another by loading data from a source to a target workspace. Data mapping rules described in a cross-reference database are applied during the load. The Esri Mapping and Charting solutions products all install a cross-reference database that you can use, or you can create one using the Create Cross-reference tool.

Data that matches the schema defined in the cross-reference database for the source is appended to the target workspace. The cross-reference database contains a DatasetMapping table that lists pairs of source and target dataset names. Each source and target name pair can have a WHERE clause and a subtype. The WHERE clause defines a subset of features in the source to append to the target. Subtype identifies a subtype in the target feature class into which features are loaded.

Usage

Syntax

LoadData_production (in_cross_reference, in_sources, in_target, {in_dataset_map_defs}, {row_level_errors})
ParameterExplanationData Type
in_cross_reference

The path to a cross-reference database. Cross-reference databases for each product specification can be found in the Program Files\ArcGIS\Esri[SolutionName]\Desktop10.1\[ProductName]\[SpecificationName]\DataConversion directory.

Workspace
in_sources
[in_sources,...]

A list of workspaces that contain the source features to load into the target workspace.

Workspace
in_target

The target workspace that contains the schema referenced in the cross-reference database. Source features are loaded into this workspace.

Workspace
in_dataset_map_defs
[in_dataset_map_defs,...]
(Optional)

The source to target feature class mapping list. The format of this string is id | SourceDataset | TargetDataset | WhereClause | Subtype.

String
row_level_errors
(Optional)

Indicates if the tool will log errors that occur while inserting new rows into feature classes and tables in in_target.

  • ROW_LEVEL_ERROR_LOGGINGLog errors that occur during individual row-level inserts
  • NO_ROW_LEVEL_ERROR_LOGGINGDo not log errors that occur during individual row-level inserts. This is the default.
Boolean

Code Sample

LoadData example (Python window)

The following Python window script demonstrates how to use the LoadData tool.

# Name: LoadData_Example.py
# Description: Executes the LoadData_production function using a single feature class in the source and target workspaces
# Requirements: Production Mapping extension

# path to the cross reference database
cross_ref_db = "C:/Program Files/ESRIDefenseMapping/Desktop10.1/Mgcp/DataConversion/MGCP_general_TRD30_GDB_to_MGCP_general_TRD30_GDB.mdb"

# the dataset mapping string
dataset_mapping = '10 | RoadL | RoadL |  | 0'

# source and target workspaces
source_workspace = "C:/gisdata/Export_MGCP_TRD3.gdb"
target_workspace = "C:/gisdata/mgcp_export.gdb"

# exec the tool
arcpy.LoadData_production(cross_ref_db,source_workspace,target_workspace,dataset_mapping)
LoadData example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the LoadData tool with three feature classes.

# Name: LoadData_standalone_Example.py
# Description: Executes the LoadData_production function with multiple feature classes in the source and target workspaces
# Requirements: Production Mapping extension

import arcpy

# check out the extension
arcpy.CheckOutExtension("foundation")

# path to the cross reference database
cross_ref_db = "C:/Program Files (x86)/ESRIDefenseMapping/Desktop10.1/Mgcp/DataConversion/MGCP_general_TRD30_GDB_to_MGCP_general_TRD30_GDB.mdb"

# the dataset mapping string
dataset_mapping = "10 | RoadL | RoadL |  | 0;34 | BuildP | BuildP |  | 0;39 | CoastA | CoastA |  | 0"

# source and target workspaces
source_workspace = r'C:\gisdata\Export_MGCP_TRD3.gdb'
target_workspace = r'c:\gisdata\mgcp_export.gdb'

# truncate the target feature classes
arcpy.env.workspace = target_workspace + "/features/"
arcpy.DeleteFeatures_management('RoadL')
arcpy.DeleteFeatures_management('CoastA')
arcpy.DeleteFeatures_management('BuildP')

# exec the tool
arcpy.LoadData_production(cross_ref_db,source_workspace,target_workspace,dataset_mapping)

# check feature count after running the tool
arcpy.GetCount_management('RoadL')
print 'RoadL ' + arcpy.GetMessage(2)

arcpy.GetCount_management('CoastA')
print 'CoastA ' + arcpy.GetMessage(2)

arcpy.GetCount_management('BuildP')
print 'BuildP ' + arcpy.GetMessage(2)

# check the extension back in
arcpy.CheckInExtension("foundation")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: Requires Production Mapping
ArcGIS for Desktop Advanced: Requires Production Mapping
12/18/2014