Create Replica (Production Mapping)
Summary
A replica is a copy of an enterprise geodatabase dataset. You can work independently with replicas and synchronize changes with the data's original geodatabase.
This tool creates a replica in a personal, file, or enterprise geodatabase from a specified list of feature classes, layers, datasets, or tables. Optionally, you can use a filter geometry from another feature layer to replicate features within an area of interest.
Usage
-
All datasets must be from the same ArcSDE database.
This tool is similar to the Create Replica tool in the Data Management toolbox. This tool allows you to use a selected feature in another feature layer as an area of interest for replicated features. Any features from Replica Datasets with the USE_FILTERS option that intersect or are contained by the selected feature in Filter Feature Layer will be replicated to the Child Workspace.
Data replicated with the ONE_WAY and TWO_WAY options must have a populated Global ID type field. Use the Add Global IDs tool in the Management toolbox to create and populate a global ID field in your data.
For checkout and one-way replicas the child replica geodatabase can be an ArcSDE, file, or personal geodatabase.
For two-way and one-way child–to–parent replicas the child geodatabase must be ArcSDE.
To use archiving for one-way replicas the parent workspace must be connected to the Default version. For one-way child-to-parent replicas the child workspace must be connected to the Default version.
Use selection sets and layer definition queries to limit or specify features to replicate. To do this in ArcCatalog, use the Make Feature Layer tool or create layer files for Replica Datasets.
Related data is replicated by default. To avoid replicating related data, you must specify each relationship class that defines the related objects you want to exclude using the Exclude Relationship Classes parameter.
Related data is replicated in a forward direction, from origin to destination.
Syntax
Parameter | Explanation | Data Type |
in_datasets |
Value table of rows that contain a dataset to replicate and a filter option for that dataset. Specifying a filter option allows you to control how rows are replicated per dataset. Filter options include the following:
| Value Table |
in_replicatype | The type of replica to create:
| String |
in_childworkspace |
The path to and name of the workspace that will contain the replicated data. | File; GeoDataServer; Workspace |
in_replicaname |
The name of the replica you create. | String |
in_reuse_schema (Optional) | Indicates whether to reuse the schema of existing data in the in_childworkspace. This option can reduce the time required to replicate data by not re-creating existing schemas in the in_childworkspace. The in_reuse_schema is most efficient when used to replicate data into empty schemas in the in_childworkspace. This option is only available for checkout replicas.
| String |
in_usefilter (Optional) | Replicates features that either intersect or are contained by in_features. Only applied to in_datasets that have the USE_FILTERS option.
| Boolean |
in_filtertype (Optional) |
Specifies the spatial relationship between in_datasets and in_features.
| String |
in_features (Optional) |
Feature layer with one selected feature. | Layer |
in_access_type (Optional) | Indicates the feature information model type to replicate. Model type specifies either simple or complex features.
| String |
in_use_archiving (Optional) |
Specifies whether to use the archive class to track changes instead of using the versioning delta tables. This is only available for one-way replicas. The in_replicatype must be created from the DEFAULT version.
| Boolean |
in_exclude_rel_classes [in_exclude_rel_classes,...] (Optional) |
The list of relationship classes whose relationships you want to exclude from replication. The relationship classes will still be included if both datasets that participate are present, but the related objects are not replicated. | Relationship Class |
Code Sample
The following stand-alone script demonstrates how to use the CreateReplica tool.
# Name: CreateReplica.py
# Description: Creates a checkout replica
# Requirements: Esri Production Mapping
import arcpy
# check out a foundation license
arcpy.CheckOutExtension("Foundation")
# set gp environment
workspace="c:/data"
arcpy.env.workspace=workspace
arcpy.addOutputsToMap = True
# variables for tool parameters
filterFeatureClass = "Austin.gdb/AOI"
filterFeature = "AOI Layer"
filterWhere="MSNAME='Austin East'"
selectType="NEW_SELECTION"
checkoutDb = "checkoutDb.gdb"
# note: change the fully qualified name to your database.ownser
inDatasets="austin.sde/database.owner.TopographicMap/database.owner.ElevationP USE_FILTERS"
replicaType="CHECKOUT"
replicaName="austin_elevations_contours"
reuseSchema="DO_NOT_REUSE"
useFilter="FILTER_BY_GEOMETRY"
filterType="INTERSECTS"
# Create an in_features feature layer
if arcpy.Exists(filterFeature) == False:
arcpy.MakeFeatureLayer_management(filterFeatureClass,filterFeature)
# select one feature from the feature layer
arcpy.SelectLayerByAttribute_management(filterFeature,selectType,filterWhere)
# make a new geodatabase for the replica gdb
if arcpy.Exists(checkoutDb) == False:
arcpy.CreateFileGDB_management(workspace,checkoutDb)
# check out some data into the new file gdb
arcpy.CreateReplica_production(inDatasets,replicaType,checkoutDb,replicaName,reuseSchema,useFilter,filterType,filterFeature)
print arcpy.GetMessages()