Create Replica (Production Mapping)
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.
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 (in_datasets) that intersect or are contained by the selected feature in Filter Feature Layer (in_features) will be replicated to the Child Workspace (in_childworkspace).
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 check-out 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 (in_datasets).
To use this tool in a stand-alone script, check out a Production Mapping foundation license: arcpy.CheckOutExtension("Foundation").
The data to replicate. This can consist of individual feature classes and tables or entire datasets.
|Feature Layer; Table View; Dataset|
The type of replica to create:
The path to and name of the workspace that is going to contain the replicated data.
The name of the replica you are going to create.
Indicates whether to reuse the schema of existing data in in_childworkspace. This option can reduce the time required to replicate data by not recreating existing schemas in in_childworkspace. in_reuse_schema is most efficient when used to replicate data into empty schemas in in_childworkspace. This option is only available for check-out replicas.
Replicates features that either intersect or are contained by features in the in_features feature layer.
Specifies the spatial relationship between in_datasets and in_features.
Feature layer with one selected feature.
Indicates the feature information model type to replicate. Model type specifies either simple or complex features.
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. in_replicatype must be created from the DEFAULT version.
This script demonstrates the use of the Production Mapping CreateReplica tool. The script creates a replica of Production Mapping SoCal sample data stored in ArcSDE. The script selects a single feature in the CoastA feature class. The script creates a replica of all TreesA features that intersect the selected feature in CoastA. Replicated features are written to a file geodatabase.
# Name: CreateReplica.py # Description: Creates a checkout replica from the SoCal sample data # Author: ESRI # Date: March 2010 import arcpy # check out a foundation license arcpy.CheckOutExtension("Foundation") # import the production mapping toolbox - you may have to change this path arcpy.ImportToolbox(r'C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Production Mapping Tools.tbx') # set our workspace to an sde connection file arcpy.env.workspace = "c:/data/SoCal.sde" # fully qualified name to an ArcSDE feature class (dataset/feature class) coastpath = "socal.GIS.SoCal/socal.GIS.CoastA" # make a feature layer from islands in the CoastA feature class in the # prod mapping sample data if arcpy.Exists("Coast") == False: arcpy.MakeFeatureLayer_management(coastpath,"Coast") # select an island - verify that objectid 84 is an island in your data arcpy.SelectLayerByAttribute_management("Coast","NEW_SELECTION","objectid=84") checkoutDb = "c:/data/SoCalIslandTrees.gdb" # make a new geodatabase if arcpy.Exists(checkoutDb) == False: arcpy.CreateFileGDB_management("c:/data","SoCalIslandTrees.gdb") # another fully qualified ArcSDE name (dataset/feature class) treespath="socal.GIS.SoCal/socal.GIS.TreesA" # check out some data into the new file gdb arcpy.CreateReplica_production(treespath,"CHECKOUT",checkoutDb,"islandTrees","TRUE","INTERSECTS","Coast") # check the extension in arcpy.CheckInExtension("Foundation")
This ArcGIS Python window example demonstrates how to use the CreateReplica tool with the ONE_WAY replica type. The script replicates production mapping SC_Index sample data from an Oracle instance to an SQL Server Instance.
sourceDb=r'c:\data\Socal_sample_oracle.sde\SOCAL_DATA.SC_Index' targetDb=r'C:\data\SoCal.sde' # import the production mapping toolbox - you may have to change this path arcpy.ImportToolbox(r'C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Production Mapping Tools.tbx') arcpy.CreateReplica_production(sourceDb,"ONE_WAY",targetDb,"indexRepl1","NO_FILTER_BY_GEOMETRY","INTERSECTS","")