Detect Feature Changes (Data Management)

License Level:BasicStandardAdvanced


Finds where the update line features spatially match the base line features and detects spatial changes, attribute changes, or both, as well as no change, and creates an output feature class containing matched update features with information about their changes, unmatched update features, and unmatched base features.

Learn more about how feature matching works


Detect Feature Changes



DetectFeatureChanges_management (update_features, base_features, out_feature_class, search_distance, {match_fields}, {out_match_table}, {change_tolerance}, {compare_fields})
ParameterExplanationData Type

Line features to compare to the base features.

Feature Layer

Line features to be compared with update features for change detection.

Feature Layer

Output line feature class with change information. The output contains all participating update features (matched and unmatched) and any unmatched base features.

Feature Class

The distance used to search for match candidates. A distance must be specified and it must be greater than zero. You can choose a preferred unit; the default is the feature unit.

Linear unit
[[source_field, target_field],...]

Lists of fields from update and base features. If specified, each pair of fields are checked for match candidates to help determine the right match.

Value Table

The output table containing complete feature matching information.


The distance used to determine if there is a spatial change. All matched update features are checked against this tolerance. If any parts of an update feature falls outside the zone, it is considered a spatial change. A distance can be equal to or greater than zero. The default is 0. When a value greater than zero is specified, the output will include LEN_PCT and LEN_ABS fields. You can choose a preferred unit; the default is the feature unit.

Linear unit
[[source_field, target_field],...]

Fields to determine if there is an attribute change between matched update and base features.

Value Table

Code Sample

DetectFeatureChanges example 1 (Python window)

The following Python window script demonstrates how to use the DetectFeatureChanges function in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data"
                                "base_Roads.shp", "output_changes.shp"
                                "25 Feet", #, #, "7.6 Meterd",
                                ["rdClass", "roadClass"])
DetectFeatureChanges example 2 (stand-alone Python script)

The following stand-alone script is an example of how to apply the DetectFeatureChanges function in a scripting environment.

# Name:
# Description: Perform change detection between newly received road data and
#              existing road data and find the number of new roads and the
#              total length of them.
# Author:      Esri
# -----------------------------------------------------------------------

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.overwriteOutput = True
env.workspace = r"D:\conflationTools\ScriptExamples\data.gdb"

# Set local variables
updateFeatures = "updateRoads"
baseFeatures = "baseRoads"
dfcOutput = "dfc_out"

search_distance = "300 Feet"
match_fields = "RD_NAME FULLNAME"

statsTable = "new_roads_stats"

# Perform spatial change detection
arcpy.DetectFeatureChanges_management(updateFeatures, baseFeatures, dfcOutput, search_distance, match_fields)

# ====================================================================================
# Note 1:  The result of DetectFeatureChanges may contain errors; see tool reference.
#          Inspection and editing may be necessary to ensure correct CHANGE_TYPE N, which
#          represents un-matched update feautres, before further calculations.
#          One of the quick ways of checking whether the CHANGE_TYPE N features have
#          matching base features is to find their mid-points and use them to search for
#          features in base data, as processed below.
# ====================================================================================

# ======== Check update roads with CHANGE_TYPE N for potential match
# Make Feature Layer with selection of CHANGE_TYPE = 'N' (un-matched update features)
arcpy.MakeFeatureLayer_management(dfcOutput, "sel_N_layer", "CHANGE_TYPE = 'N'")

# Get mid-points of the selected features; the mid-points carry all the attributes.
arcpy.FeatureVerticesToPoints_management("sel_N_layer", "in_memory\midPts", "MID")

# Find nearest base features from the mid-points
arcpy.Near_analysis("in_memory\midPts", baseFeatures, "300 Feet")

# ====================================================================================
# Note 2:  At this point you can manually inspect the midPts by the NEAR_DIST values; 
#          the lower the values, the higher chance (not always) a match was missed in the 
#          dfc process. Delete features from midPts that have found matching base features 
#          before further process.
# ====================================================================================

# Transfer CHANGE_TYPE values from features of midPts to update features
arcpy.JoinField_management(updateFeatures, "OBJECTID", "in_memory\midPts", "UPDATE_FID", "CHANGE_TYPE")

# Get the count of new roads and the total length; the remaining roads have
# Null values for CHANGE_TYPE.
arcpy.Frequency_analysis(updateFeatures, statsTable, "CHANGE_TYPE", "Shape_Length")


Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: No
ArcGIS for Desktop Advanced: Yes