The snapping env is very complex and helpful.
When I develop my own map tool and the snapping is on I see the snapping on the screen but the coordinates I get to my code is the original coordinates without the snap.
If I need to used the snapped point I have to write the snap in my code.
This information does exists somewhere since it is displayed on screen.
Is there an option to get the snapped point from the event?
This will help a lot if you develop some custom editing tool that need to use snapping.
Thanks
future release? How can I get the coordinates of a snap point? - Esri Community
Fortunately it was added at a later release 🙂
You can get the snapped location from the sketch via the SnapResult class.
The concept help describes its use through the SnappingResults property on the map tool. This examples references sketchcompleted but you could also listen to sketchmodified.
From what I'm seeing in the links provided, the SnapResult ONLY applies to points in the sketch. But if you are building a complex tool that cannot be handled through a simple sketch, it would seem you get no snapping results. I can set UseSnapping to true/false for the parts I want snapping or not and the snapping indicators show up appropriately. But since I'm not doing a simple sketch, I can't seem to get those snapping locations that I would want to use. Maybe there's some way to get around this but this seems like big assumption that the only place you would need to know a snap point is in a sketch tool.
So I came up with something that is generally working. I set my SketchType to Point as this doesn't add any sketch overlays on the map but allows me to get the SnapLocation from the SnappingResults when I need it. But it's still not perfect. The SnappingResults are only updated when the point sketch is complete. Specifically it seems to happen between the MouseDown and MouseUp events. So while I was originally processing on the MouseDown, the snapping location isn't updated yet so I had to move it to MouseUp. But this also means that there's no snapping information available on MouseMove. I'm specifically drawing some overlays showing what the result will be from the user input where I want to be able to snap. I'm able to perform the updates with the snap locations. But the overlay can't get access to the current snap point and is not drawn at the final snap location causing a bit of a disconnect between what I'm showing the user and what the final result is going to be.