检测要素更改 (Data Management)

许可等级:BasicStandardAdvanced

摘要

查找更新线要素与基本线要素在空间上匹配的位置,并检测空间更改、属性更改或同时检测这两种更改以及无更改的情况,并创建一个包含匹配的更新要素及其更改信息、不匹配的更新要素和不匹配的基础要素的输出要素类。

了解有关“要素匹配”工作原理的详细信息

插图

Detect Feature Changes

用法

语法

DetectFeatureChanges_management (update_features, base_features, out_feature_class, search_distance, {match_fields}, {out_match_table}, {change_tolerance}, {compare_fields})
参数说明数据类型
update_features

与基础要素进行比较的线要素。

Feature Layer
base_features

与更新要素进行比较以检测更改的线要素。

Feature Layer
out_feature_class

含更改信息的输出线要素类。输出包含所有参与的更新要素(匹配的和不匹配的)以及任何不匹配的基础要素。

Feature Class
search_distance

用于搜索匹配候选项的距离。必须指定一个距离,且此距离必须大于零。可以选择首选单位;默认为要素单位。

Linear unit
match_fields
[[source_field, target_field],...]
(可选)

来自更新要素和基础要素的字段列表。如果指定,将检查每对字段中的匹配候选项,以帮助确定正确的匹配。

Value Table
out_match_table
(可选)

包含完整的要素匹配信息的输出表。

Table
change_tolerance
(可选)

用于确定是否存在空间更改的距离。将根据此容差检查所有匹配的更新要素。更新要素的任何部分超出缓冲区范围均被视为空间更改。距离可以等于或大于零。默认值为 0。当值大于零时,输出中将包括 LEN_PCTLEN_ABS 字段。可以选择首选单位;默认为要素单位。

Linear unit
compare_fields
[[source_field, target_field],...]
(可选)

用于确定匹配更新要素与基础要素之间是否存在属性更改的字段。

Value Table

代码实例

DetectFeatureChanges 示例 1(Python 窗口)

以下 Python 窗口脚本演示了如何在即时模式下使用 DetectFeatureChanges 函数。

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.DetectFeatureChanges_edit("update_Roads.shp",
                                "base_Roads.shp", "output_changes.shp"
                                "25 Feet", #, #, "7.6 Meterd",
                                ["rdClass", "roadClass"])
DetectFeatureChanges 示例 2(独立 Python 脚本)

以下独立脚本用于说明如何在脚本环境中应用 DetectFeatureChanges 函数。

# Name:        DetectFeatureChanges_example_script2.py
# 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")

环境

相关主题

许可信息

ArcGIS for Desktop Basic: 否
ArcGIS for Desktop Standard: 否
ArcGIS for Desktop Advanced: 是
5/10/2014