Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use a standalone snap agent. Is that not possible?

Here's some code:

        // instantiate these agents.
        _snapSupportAgent = new FeatureSnapClass();
        _snapSupportAgent.FeatureClass = _parcelSplitLine;
        _snapSupportAgent.HitType = esriGeometryHitPartType.esriGeometryPartBoundary;

        _snapParcelAgent = new FeatureSnapClass();
        _snapParcelAgent.FeatureClass = _parcelSplitLine;
        _snapParcelAgent.HitType = esriGeometryHitPartType.esriGeometryPartBoundary;

Later on code:

        var newPoint = new PointClass();

When I do that, I get a nasty protected memory exception. I'm editing directly to a IWorkspaceEdit, without interference of the IEditor.

share|improve this question
Did you try using IEngineSnapAgent instead? There's a sample here. – Kirk Kuykendall Dec 15 '12 at 17:20
I'll try that, but it's not an engine application. It's working under a custom form with a AxMapControl, true, but it's not ArcEngine... – George Dec 17 '12 at 14:23
up vote 3 down vote accepted

I can't find the documentation now, but AFAIK, Snapping can only be done using the ISnapEnvironment Interface via the IEditor.

The IFeatureSnap is used in two kinds of cases: Defining a custom snap agents or accessing the snap agents in the snap environment. It is the snap environment which actually does the snapping.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.