Snap (Editing)

Summary

Moves points or vertices to coincide exactly with the vertices, edges, or end points of other features. Snapping rules can be specified to control whether the input vertices are snapped to the nearest vertex, edge, or endpoint within a specified distance.

Illustration

Snap Illustration
Snap Cases

Usage

Syntax

Snap_edit (in_features, snap_environment)
ParameterExplanationData Type
in_features

The input features whose vertices will be snapped to the vertices, edges, or end points of other features. The input features can be points, multipoints, lines, or polygons.

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

Snapping Environment Components:

  • Features -- Features that the input features' vertices will be snapped to. These features can be points, multipoints, lines, or polygons.
  • Type -- Type of feature part that the input features' vertices can be snapped to (END | VERTEX | EDGE).
  • Distance -- Distance within which the input features' vertices will be snapped to the nearest vertex, edge, or end point.

Snapping Environment Type Options:

  • ENDInput feature vertices will be snapped to feature ends.
  • VERTEXInput feature vertices will be snapped to feature vertices.
  • EDGEInput feature vertices will be snapped to feature edges.
NoteNote:

In the Snap Environment parameter, if no unit is entered with the Distance (i.e., '10' instead of '10 Meters'), the linear or angular unit from the input feature's coordinate system will be used as default. If the input features have a projected coordinate system, the linear unit will be used.

Value Table

Code Sample

Snap Example (Python Window)

The following Python Window script demonstrates how to use the Snap tool.

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"]])
Snap Example (Stand-alone script)

Snap climate regions boundary to vegetation layer boundary to ensure common boundary is coincident

# 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])

Environments

Related Topics

Licensing Information

ArcView: No
ArcEditor: Yes
ArcInfo: Yes

4/27/2011