捕捉 (编辑)

许可等级:BasicStandardAdvanced

摘要

移动点或折点,使其与其他要素的折点、边或端点精确重合。可指定捕捉规则来控制是将输入折点捕捉到指定距离范围内的最近折点、边还是端点。

插图

Snap Illustration
捕捉案例

用法

语法

Snap_edit (in_features, snap_environment)
参数说明数据类型
in_features

折点将被捕捉到其他要素的折点、边或端点的输入要素。输入要素可以是点、多点、线或面。

Feature Layer
snap_environment
[[Features, Type, Distance],...]

捕捉环境的组成部分:

  • 要素 - 要作为输入要素折点捕捉目标的要素。这些要素可以是点、多点、线或面。
  • 类型 - 可作为输入要素折点捕捉目标的要素部分的类型 (END | VERTEX | EDGE)。
  • 距离 - 输入要素折点被捕捉到此距离范围内的最近折点、边或端点。

捕捉环境的类型选项:

  • END将输入要素折点捕捉到要素末端。
  • VERTEX将输入要素折点捕捉到要素折点。
  • EDGE将输入要素折点捕捉到要素边。
注注:

在“捕捉环境”参数中,如果输入“距离”时未带单位(如,输入“10”而不是“10 米”),则默认情况下将使用输入要素的坐标系的线性单位或角度单位。如果输入要素使用投影坐标系,则将使用线性单位。

Value Table

代码实例

捕捉示例(Python 窗口)

以下 Python 窗口脚本演示了如何使用“捕捉”工具。

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.Snap_edit("climate.shp", [["Habitat_Analysis.gdb/vegtype", "VERTEX", "30 Feet"], ["Habitat_Analysis.gdb/vegtype", "EDGE", "20 Feet"]])
捕捉示例(独立脚本)

将气候区域边界捕捉到植被图层边界以确保公共边界重合。

# Name: Snap.py
# Description: Snap climate regions boundary to vegetation layer boundary 
#                    to ensure common boundary is coincident
# Author: ESRI

# import system modules 
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/data"

# Make backup copy of climate regions feature class, since modification with 
#  the Editing tools below is permanent
climate = "climate.shp"
climateBackup = "C:/output/Output.gdb/climateBackup"
arcpy.CopyFeatures_management(climate, climateBackup)

# Densify climate regions feature class to make sure there are enough vertices 
#  to match detail of vegetation layer when layers are snapped
arcpy.Densify_edit(climate, "DISTANCE", "10 Feet")

# Snap climate regions feature class to  vegetation layer vertices and edge
veg = "Habitat_Analysis.gdb/vegtype"
# first, snap climate region vertices to the nearest vegetation layer vertex within 30 Feet
snapEnv1 = [veg, "VERTEX", "30 Feet"]
# second, snap climate region vertices to the nearest vegetation layer edge within 20 Feet
snapEnv2 = [veg, "EDGE", "20 Feet"]
arcpy.Snap_edit(climate, [snapEnv1, snapEnv2])

环境

相关主题

许可信息

ArcGIS for Desktop Basic:否
ArcGIS for Desktop Standard:是
ArcGIS for Desktop Advanced:是
9/15/2013