Calculate Layer Snapshot (Production Mapping)

许可等级:BasicStandardAdvanced

摘要

Calculates a snapshot of a feature layer by creating a snapshot value of feature geometry, extent, and symbology. The tool stores the snapshot value in a long integer field in the Input Features feature class. The Compare Layer To Snapshot tool uses the snapshot value to identify changes to geometry, extent, and symbology in a layer across multiple map documents.

The tool can optionally populate metadata including date and time, user name, reference scale, and an historical string. Metadata is also written to the Input Features feature class.

用法

语法

CalculateLayerSnapshot_production (in_features, snapshot_field_name, {hist_string}, {history_field_name}, {date_field_name}, {username_field_name}, {output_workspace}, {reference_scale}, {refscale_field_name}, {fc_suffix})
参数说明数据类型
in_features
[in_features,...]

List of feature layers to populate with snapshot information.

Layer
snapshot_field_name

The name of the field that will store the snapshot value. The field type must be LONG.

Field
hist_string
(可选)

A string to insert into the history_field_name field. Use to define a custom historical note.

String
history_field_name
(可选)

The name of the field that will store the historical string. The field type must be TEXT.

Field
date_field_name
(可选)

The name of the field that will store date and time values. The field type must be DATE.

Field
username_field_name
(可选)

The name of the field that will store a user name. The field type must be TEXT.

Field
output_workspace
(可选)

The workspace that will store the output of Feature Outline Masks. This parameter requires that you set reference_scale and refscale_field_name.

Workspace
reference_scale
(可选)

The scale in which a symbol appears at its true size. The Feature Outline Masks tool uses reference scale to calculate masking geometry. This parameter requires that you set output_workspace first.

Double
refscale_field_name
(可选)

The name of the field that will store the reference_scale value. The tool creates this field in the output feature class created by Feature Outline Masks . This parameter requires that you set output_workspace first.

String
fc_suffix
(可选)

The suffix that will be appended to the feature layer name specified in input_features. The suffix defaults to _LayerSnapshot.

String

代码实例

CalculateLayerSnapshot example (stand–alone script)

The following stand-alone script demonstrates how to use the CalculateLayerSnapshot tool.

# Name: CalculateLayerSnapshot_Standalone.py
# Description: Creates a layer snapshot on sample data.
# Requirements: Esri Production Mapping

import arcpy

# check out a foundation license
arcpy.CheckOutExtension("Foundation")

# use the RailRoadL feature class from sample data
railroads = "C:/data/Austin.gdb/TopographicMap/RailroadL"
railLayer = "railLayer"
snapfield="snapshot"

# calculateLayerSnapshot tool requires a feature layer
arcpy.MakeFeatureLayer_management(railroads,railLayer)

# check for the snapshot field
fieldNames = [f.name for f in arcpy.ListFields(railLayer,snapfield,"LONG")]
if fieldNames.count(snapfield) < 1:
    arcpy.AddField_management(railLayer,snapfield,"LONG")

# exec the tool
arcpy.CalculateLayerSnapshot_production(railLayer,snapfield)
print arcpy.GetMessages()
CalculateLayerSnapshot example 2 (Python window)

The following Python window script demonstrates how to use the CalculateLayerSnapshot tool.

import arcpy

# set gp environment
work="c:/data"
arcpy.env.workspace=work
arcpy.env.addOutputsToMap = True
arcpy.env.overwriteOutput = True

# in_features variables
buildingP="Austin.gdb/TopographicMap/BuildingP"
buildingLyr="buildingLyr"
snapfield="snapshot"
histfield="history"
datefield="date_time"
namefield="username"

# optional parameter data
history="Calculate layer snapshot for BuildingP"
extWork="outExtents.gdb"
refScale=12000
refField="refscale"
fcSuffix="buildP_snapshot"

# make a feature layer for in_features
arcpy.MakeFeatureLayer_management(buildingP,buildingLyr)

# add layer snapshot fields to in_features
arcpy.AddField_management(buildingP,snapfield,"LONG")
arcpy.AddField_management(buildingP,histfield,"TEXT")
arcpy.AddField_management(buildingP,datefield,"DATE")
arcpy.AddField_management(buildingP,namefield,"TEXT")
arcpy.AddField_management(buildingP,refField,"LONG")

# create a new fGdb to store the snapshot data
if arcpy.Exists("outExtents.gdb")==False:
    arcpy.CreateFileGDB_management(work,"outExtents.gdb")

# invoke the tool
arcpy.CalculateLayerSnapshot_production(buildingLyr,snapfield,history,histfield,datefield,namefield,extWork,refScale,refField,fcSuffix)

环境

相关主题

许可信息

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