This document is archived and information here might be outdated.  Recommended version.


Snapping in ArcGIS (ArcObjects .NET 10.5 SDK)

Snapping in ArcGIS


Summary
This topic outlines the snapping capabilities in ArcGIS and explains which capabilities are most appropriate for developers.

In this topic


About snapping in ArcGIS

When developing tools in ArcGIS, one of the most common capabilities desired is the ability to precisely define the location of the cursor on the display in relation to another entity (usually a feature) to help complete a given task accurately and efficiently. 
ArcGIS has two main alternatives to support snapping: the ArcGIS snapping environment and the editing snapping environment.  Each has advantages and disadvantages.  Understanding these differences, along with deployment options, will help you decide which alternative is most appropriate for you.

ArcGIS snapping environment

The ArcGIS snapping environment provides the most generic framework for supporting snapping in your customizations.  It is available to both Desktop and Engine developers, using the same set of components. This is advantageous when writing a generic tool that might be used in ArcMap as well as in a custom ArcGIS Engine application.
For a detailed discussion on the ArcGIS snapping environment, see Working with the ArcGIS snapping environment.
In general, using the ArcGIS snapping environment is preferred.

Editing snapping environment

The editing snapping environment provides a fine level of control to determine what features can be snapped to, including snapping in x,y, and z.  However, the editing snapping environment is only available when you're in an edit session. 
The interface you use depends on how your customization will be deployed.  For desktop customizations, use ISnapEnvironment in the ESRI.ArcGIS.Editor assembly; for ArcGIS Engine customizations, use IEngineSnapEnvironment in the ESRI.ArcGIS.Controls assembly. 
For a detailed discussion on the editing snapping environments, see Working with the editor snap environment or How to work with the snap environment.

Comparing the snapping environments

The following table lists the key aspects of snapping and compares the ArcGIS and editing snapping environments:
ArcGIS snapping environment
Editing snapping environment
Desktop support
Yes
Yes*
Engine support
Yes
Yes*
Configuration of snapping agents
Yes
Yes
Available outside an edit session
Yes
No
Requires management of cache
No
Yes
Respects definition queries on layers
Yes
No
Supports customization of snap tips
Yes
No
Supports filtering of individual layers
Yes**
Yes
Supports custom snapping types
No
Yes
Access to snap result via the application programming interface (API)
Yes
No
* The editing snapping environment is supported in ArcGIS Desktop and Engine but requires different interfaces for each.
** Individual layer configuration is only supported through the API.


See Also:

Working with the ArcGIS snapping environment
Working with the editor snap environment
How to work with the snap environment




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Basic ArcGIS Desktop Basic
Engine Developer Kit Engine