Buffer snap


This document was published with and applies to ArcGIS 9.3.
A 9.2 version also exists.
Purpose
This code demonstrates how to create a snapping agent based on a buffer around the points of the current editable point feature class. The ISnapAgent interface does not provide a simple way to get the editor so IExtension::Startup method was used to get the editor. An IFeatureCache object is used to contain the point features closest to the cursor location and then the snap is called to change the location of the new point. This will relocate the new feature 10 map units from the snapped feature.
 
For electrical datasets it is common to want to snap primary lines to the outside of the symbol representing a pole. To make this happen you will need to specify that you want pole symbols to scale, then use this snapping agent with an appropriate buffer distance (based on the size of the pole symbol).

Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo

Additional Requirements
  • An edit session using point data.

How to use

See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).

  1. Open the solution file of the project you want to use and build the solution. This registers the class in the ESRI Snap Agents component category.
  2. Start an edit session with at least one point layer loaded.
  3. Open the Snapping Environment dialog box and turn on the Buffer Snap agent. Also consider checking the current snap tolerance.
  4. Begin adding new features and you will be able to snap to buffers (10 map units) around the point features in the specified feature class.

BufferSnap.cs Class file containing buffer snapping agent
AssemblyInfo.cs Assembly information for BufferSnapCS library
Download the C# files
AssemblyInfo.vb Assembly information for the BufferSnapVBNet library
BufferSnap.vb Class file containing buffer snapping agent
Download the VB.NET files

Download the files for all languages