Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

Matt

share|improve this question
    
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
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.