Create Replica (Production Mapping)
Résumé
Creates a replica to a personal, file, or enterprise geodatabase from a specified list of feature classes, layers, datasets, and/or tables in an enterprise geodatabase. Optionally 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 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").
Syntaxe
Paramètre | Explication | Type de donnée |
in_datasets [in_datasets,...] |
The data that is going to be replicated. This can consist of individual feature classes and tables or entire datasets. | Feature Layer; Table View; Dataset |
in_replicatype | The type of replica to create:
| String |
in_childworkspace |
The path to and name of the workspace that is going to contain the replicated data. | Workspace; GeoDataServer |
in_replicaname |
The name of the replica you are going to create. | String |
in_reuse_schema (Facultatif) | Indicates whether to reuse a geodatabase that contains the schema of the data you want to replicate. This reduces the amount of time required to replicate the data. This option is only available for check-out replicas.
| String |
in_usefilter (Facultatif) | Replicates features that either intersect or are contained by features in the in_features feature layer.
| Boolean |
in_filtertype (Facultatif) |
Specifies the spatial relationship between in_datasets and in_features.
| String |
in_features (Facultatif) |
Feature layer with one selected feature. | Layer |
Exemple de code
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","")