Compare Layer to Snapshot (Production Mapping)

Resumen

This tool, in conjunction with Calculate Layer Snapshot, selects features that have had geometry, extent, or symbology changes.

Uso

Sintaxis

CompareLayerToSnapshot_production (input_features, extent_field_name, {invert_selection})
ParámetroExplicaciónTipo de datos
input_features
[input_features,...]

The input list of feature layers and feature classes to check for geometry and symbology changes.

Feature Layer
extent_field_name

The field name containing the checksum values created by Calculate Layer Snapshot.

String
invert_selection
(Opcional)

Specifies if the tool should select changed features or invert the selection to unchanged features.

  • TRUESelect only features whose geometries, extents, and symbols have not changed.
  • FALSESelect only features whose geometries, extents, and symbols have changed. This is the default.
Boolean

Ejemplo de código

CompareLayerToSnapshot example 1 (Python window)

The following Python window script demonstrates how to use the CompareLayerToSnapshot function with Production Mapping sample data. The script executes the CompareLayerToSnapshot tool and then checks for any selected features using the Describe function. The script writes any selected features to a new feature class, ChangedPoliticalBounds in the C:/data/SoCal.gdb database. To use this script:

  1. Add the PolbndA feature class from the SoCal.gdb sample database to ArcMap.
  2. Add a long integer field to PolbndA called polbnd_extent_info.
  3. Run the CalculateLayerSnapshot tool against PolbndA, selecting polbnd_extent_info as the Extent Field.
  4. Change the symbology of PolbndA in ArcMap.
  5. Add the following code to the python window in ArcMap.

arcpy.env.workspace = "C:/data/SoCal.gdb"
arcpy.ImportToolbox(r"C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Production Mapping Tools.tbx")
arcpy.CompareLayerToSnapshot_production("PolbndA","polbnd_extent_info","FALSE")
desc = arcpy.Describe("PolbndA")
selectedFids = desc.FIDSet
if len(selectedFids) > 0:
	arcpy.CopyFeatures_management("PolbndA","ChangedPoliticalBounds")
CompareLayerToSnapshot example 2 (Stand–alone Python script)

The following stand-alone Python script demonstrates how the CompareLayerToSnapshot tool will select features that have been changed by extent, geometry or symbology. This example uses changes in symbology. To run this script:

  1. Copy the SoCal.gdb sample production mapping geodatabase to c:\data.
  2. Display the PolbndA feature class in ArcMap.
  3. Add a new field, pol_ext_info, type LONG, to PolbndA.
  4. Run the Calculate Layer Snapshot on PolbndA, using the pol_ext_info field as an input.
  5. Close ArcMap and run the following script.

# Name: CompareLayerToSnapshot.py
# Description: Writes changed features (in this example - symbols) to a new feature class
# Author: ESRI
# Date: March 2010

import arcpy

# check out a production mapping extension license
arcpy.CheckOutExtension("Foundation")

# set the current workspace
arcpy.env.workspace = "C:/data/SoCal.gdb"

# make a feature layer from the PolbndA feature class
arcpy.MakeFeatureLayer_management("PolbndA","polbndlayer")

# import the production mapping toolbox
arcpy.ImportToolbox(r"C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Production Mapping Tools.tbx")

# check for changed features in the pol_ext_info field
arcpy.CompareLayerToSnapshot_production("polbndlayer","pol_ext_info","FALSE")

# describe the feature layer to access the the selected set
desc = arcpy.Describe("polbndlayer")

# FIDSet will contain the selected features
selectedFids = desc.FIDSet

# As the symbol in polbndlayer is different than what was written in
# the pol_ext_info field, there should be a selection set.
# If there are selectedFids (a selection set), write them to a new feature
# class in the current workspace.
if len(selectedFids) > 0:
	arcpy.CopyFeatures_management("polbndlayer","ChangedPoliticalBounds")

# check the extension in
arcpy.CheckInExtension("Foundation")

Entornos

Esta herramienta no utiliza ningún entorno de geoprocesamiento

Temas relacionados

Información de licencia

ArcView: Requiere Production Mapping
ArcEditor: Requiere Production Mapping
ArcInfo: Requiere Production Mapping

9/30/2010