Create Replica (Production Mapping)

汇总

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.

用法

语法

CreateReplica_production (in_datasets, in_replicatype, in_childworkspace, in_replicaname, {in_reuse_schema}, {in_usefilter}, {in_filtertype}, {in_features})
参数说明数据类型
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:

  • CHECKOUTCreates a replica in which the changes can be checked back into the parent geodatabase from the child. This is the default.
  • ONE_WAYCreates a replica in which changes cannot be transferred from the child to the parent, but changes can be continually synchronized from the parent to the child.
  • TWO_WAYCreates a replica in which changes can be transferred from the parent to the child and vice versa.
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
(可选)

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.

  • DO_NOT_REUSEDo not reuse schema. This is the default.
  • REUSEReuse schema.
String
in_usefilter
(可选)

Replicates features that either intersect or are contained by features in the in_features feature layer.

  • TRUEApplies the filter set in in_filtertype. You must set in_filtertype and in_features.
  • FALSEDoes not apply the spatial filter. This is the default.
Boolean
in_filtertype
(可选)

Specifies the spatial relationship between in_datasets and in_features.

  • INTERSECTSExtract features from in_datasets that intersect features in in_features. This is the default.
  • CONTAINSExtract features from in_datasets that are contained by the selected feature in the in_features.
String
in_features
(可选)

Feature layer with one selected feature.

Layer

代码示例

CreateReplica example 1 (Stand–alone Python script)

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")

CreateReplica example 2 (Python window)

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","")

环境

相关主题

许可信息

ArcView: 需要 Production Mapping
ArcEditor: 需要 Production Mapping
ArcInfo: 需要 Production Mapping

9/30/2010