ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

Calculate Layer Snapshot

  • 描述
  • 使用方法
  • 语法
  • 代码示例
  • 环境
  • 许可信息

描述

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.

使用方法

  • This tool accepts points, polylines, polygons, and annotation feature layers as input.

  • Use the Compare Layer To Snapshot tool to identify feature shape, extent, and symbology changes in a layer across multiple map documents.

  • You must add a long integer field to the Input Features feature class before running this tool. This field stores the snapshot value created by this tool. You can choose any name for this field as long as it is valid in their data source (workspace). A suggested field name is snapshot_field.

  • You can optionally add snapshot metadata to the Input Features feature class. This requires that you add the following fields to the Input Features feature class. You can choose any names for these fields as long as they are valid in their data source (workspace). Suggested field names are historical_string, username and snapshot_date.

    • A text field for Historical String Field.
    • A text field for User Name Field.
    • A date field for Date and Time Field.

  • If you set the Output Workspace parameter, the tool will execute Feature Outline Masks. This will generate an output polygon feature class in the path set in Output Workspace. You can rename the output feature class using the Output Feature Class Suffix parameter.

  • If you set snapshot metadata fields and the Output Workspace parameter, the tool will write the metadata to the feature class created by Feature Outline Masks.

  • You can only set Reference Scale if you set an Output Workspace. The tool writes the reference scale to the feature class created by Feature Outline Masks.

  • The reference scale is the scale at which a symbol appears at its true size. The reference scale is derived in the following order:

    • The geoprocessing reference scale environment setting
    • The active data frame’s reference scale
    • The value of the Reference Scale parameter

  • All feature layers listed in Input Features must have a set of commonly named attributes. For example, all feature layers must have the same name for their Snapshot Field.

  • To execute this tool in ArcCatalog, use the Make Feature Layer tool from the Python window to create a feature layer from Input Features.

语法

arcpy.production.CalculateLayerSnapshot(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.

String
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.

String
date_field_name
(可选)

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

String
username_field_name
(可选)

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

String
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 (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)
CalculateLayerSnapshot example 2 (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: ArcGIS 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()

环境

  • 当前工作空间

许可信息

  • Basic: 否
  • Standard: 需要 Production Mapping
  • Advanced: 需要 Production Mapping

相关主题

  • An overview of the Layer Snapshot toolset
  • Compare Layer to Snapshot

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2021 Esri. | 隐私政策 | 法律声明