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 tool Illustration
Example Snap tool results are shown.

Usage

    Caution:

    This tool modifies the input data. See Tools that modify or update the input data for more information and strategies to avoid undesired data changes.

  • The Snap Environment parameter allows for the vertices of the input features to be snapped to the vertices, edges, and end points of multiple layers or feature classes. When multiple snapping rules are provided, they are prioritized from top to bottom on the tool dialog box or from left to right in scripting.

  • The input features' vertices will be snapped to the nearest vertex, edge, or end point within the specified distance.

  • In the Snap Environment parameter, multiple snap rules can be designated using the same layer or feature class with a different snapping type.

  • If a layer or feature class with a selection is used as the input, only vertices of the selected features will be snapped.

  • When snapping features in a feature class to features in the same feature class, the feature with the lower Object or Feature ID will typically be snapped to the feature with the higher Object ID (OBJECTID field or FID field for shapefiles). For example, if points with OBJECTID field values of 1 and 2 are within the snapping distance, the point with an OBJECTID field value of 1 will be snapped to the location of the point with an OBJECTID field value of 2 (and not vice versa).

  • Note:

    One use case for this tool is to rectify the differences in shared or common boundaries between two datasets by snapping the vertices in one boundary to the vertices, edges, or end points of the other. If the input features do not have enough vertices to match the exact curvature of the other boundary, vertices can be added to the input features using the Densify tool to allow for an added level of detail.

Parameters

LabelExplanationData Type
Input Features

The input features with the vertices that 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

The feature classes or feature layers containing the features to snap to.

The snapping environment components are as follows:

  • Features—The features that the input features' vertices will be snapped to. These features can be points, multipoints, lines, or polygons.
  • Type—The type of feature part that the input features' vertices can be snapped to.
  • Distance—The distance within which the input features' vertices will be snapped to the nearest end point, vertex, or edge.

Available snapping types are as follows:

  • End—Input feature vertices will be snapped to feature ends.
  • Vertex—Input feature vertices will be snapped to feature vertices.
  • Edge—Input feature vertices will be snapped to feature edges.
Note:

If a distance is used without a unit (for example, 10 instead of 10 meters), the linear or angular unit from the input feature's coordinate system will be used as the default. If the input features have a projected coordinate system, its linear unit will be used.

Value Table

Derived Output

LabelExplanationData Type
Snapped Input Features

The updated input features.

Feature Class

arcpy.edit.Snap(in_features, snap_environment)
NameExplanationData Type
in_features

The input features with the vertices that 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],...]

The feature classes or feature layers containing the features to snap to.

The snapping environment components are as follows:

  • Features—The features that the input features' vertices will be snapped to. These features can be points, multipoints, lines, or polygons.
  • Type—The type of feature part that the input features' vertices can be snapped to.
  • Distance—The distance within which the input features' vertices will be snapped to the nearest end point, vertex, or edge.

Available snapping types are as follows:

  • END—Input feature vertices will be snapped to feature ends.
  • VERTEX—Input feature vertices will be snapped to feature vertices.
  • EDGE—Input feature vertices will be snapped to feature edges.
Note:

If a distance is used without a unit (for example, 10 instead of 10 meters), the linear or angular unit from the input feature's coordinate system will be used as the default. If the input features have a projected coordinate system, its linear unit will be used.

Value Table

Derived Output

NameExplanationData Type
out_feature_class

The updated input features.

Feature Class

Code sample

Snap example 1 (Python window)

The following Python window script demonstrates how to use the Snap function.

import arcpy
arcpy.env.workspace = "C:/data"

arcpy.edit.Snap("climate.shp", 
                [["Habitat_Analysis.gdb/vegtype", "VERTEX", "30 Feet"], 
                 ["Habitat_Analysis.gdb/vegtype", "EDGE", "20 Feet"]])
Snap example 2 (stand-alone script)

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

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

# import system modules 
import arcpy

# Set environment settings
arcpy.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.management.CopyFeatures(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.edit.Densify(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.edit.Snap(climate, [snapEnv1, snapEnv2])

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics