Create Replica (Production Mapping)

许可等级:BasicStandardAdvanced

摘要

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.

用法

语法

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

  • USE_FILTERSIf in_usefilter is set to FILTER_BY_GEOMETRY, the tool replicates features that either intersect or are contained by in_features.
  • SCHEMA_ONLYReplicate the schema of the dataset to in_childworkspace.
  • ALL_ROWSReplicate all rows of the dataset to in_childworkspace.
Value Table
in_replicatype

The type of replica to create:

  • CHECKOUTCreate a replica in which the changes can be checked back in to the parent geodatabase from the child. This is the default.
  • ONE_WAYCreate 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_WAYCreate 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 will contain the replicated data.

File; GeoDataServer; Workspace
in_replicaname

The name of the replica you create.

String
in_reuse_schema
(可选)

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.

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

Replicates features that either intersect or are contained by in_features. Only applied to in_datasets that have the USE_FILTERS option.

  • FILTER_BY_GEOMETRYApply the filter set in the in_filtertype. You must set in_filtertype and in_features.
  • NO_FILTER_BY_GEOMETRYDo 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 the in_features. This is the default.
  • CONTAINSExtract features from the in_datasets that are contained by the selected feature in the in_features.
String
in_features
(可选)

Feature layer with one selected feature.

Layer
in_access_type
(可选)

Indicates the feature information model type to replicate. Model type specifies either simple or complex features.

  • FULLReplicate complex types (topologies and geometric networks) to complex types in the in_childworkspace. This option requires versioned data. This is the default.
  • SIMPLEReplicate all data, including complex types, to simple types in the in_childworkspace. The data on the child is not versioned if replicated to an ArcSDE geodatabase. This allows the replica to be interoperable with simple feature viewers and editors that are not based on the ArcGIS engine.
String
in_use_archiving
(可选)

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.

  • ARCHIVINGUse archiving to track changes.
  • NO_ARCHIVINGDo not use archiving to track changes. This is the default.
Boolean
in_exclude_rel_classes
[in_exclude_rel_classes,...]
(可选)

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

代码实例

CreateReplica example (stand–alone script)

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

环境

相关主题

许可信息

ArcGIS for Desktop Basic: 否
ArcGIS for Desktop Standard: 需要 Production Mapping
ArcGIS for Desktop Advanced: 需要 Production Mapping
4/27/2014