I asked this over at the ESRI forums but lack of activity over there made me post here as well.

Does anyone know if there is a way to get the feature that something was just snapped to in the Snapping Environment in ArcGIS 10? I have code that will do this in the classic snapping mode but I would like to take advantage of the new snapping environment.

In classic snapping you could loop through the IFeatureSnapAgent.FeatureCache and perfrom a HitTest to see which feature was just snapped to.

I see you can get the location of the snapped point via ISnappingEnvironment.PointSnapper.Snap(), but this does not expose any information about what was snapped to. I see you can add/clear/update a geometry cache on the ISnappingEnvironment.PointSnapper but you can't get any of the items in cache. I'm not too sure that would be helped either way since its just geometries and not features. I guess in theory you could perform a spatial query against each layer in the map with the location of the ISnappingResult but I don't see this as something that is feasible performance wise.

I am missing something or has anyone else dealt with this limitation of the new Snapping Environment?


  • I'm sure it is something that is caught. as you can see the popup report the object layer prior to snapping – Brad Nesom Mar 13 '12 at 22:48
  • 1
    Yes, you are correct. You can get the layer name from the SnapTip via the ISnappingResult description property. However it is not a reliable source to get the layer name because the user can turn snap tips off and the property would not be populated. – Matt Mar 14 '12 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.