Résumé
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.
Utilisation
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.
Syntaxe
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})
Paramètre | Explication | Type de données |
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 (Facultatif) | A string to insert into the history_field_name field. Use to define a custom historical note. | String |
history_field_name (Facultatif) | The name of the field that will store the historical string. The field type must be TEXT. | String |
date_field_name (Facultatif) | The name of the field that will store date and time values. The field type must be DATE. | String |
username_field_name (Facultatif) | The name of the field that will store a user name. The field type must be TEXT. | String |
output_workspace (Facultatif) | 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 (Facultatif) | 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 (Facultatif) | 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 (Facultatif) | The suffix that will be appended to the feature layer name specified in input_features. The suffix defaults to _LayerSnapshot. | String |
Exemple de code
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()
Environnements
Informations de licence
- Basic: Non
- Standard: Requiert Production Mapping
- Advanced: Requiert Production Mapping