Snap Drawing to Shape Sample
This sample shows how to use the drawing tools and spatial math modules together such that if a user draws a polygon close to another polygon, it will snap to it so that you have nicely aligned polygon shapes.
To use this sample, click the polygon drawing button in the top left corner of the map. Then click several points on the map to draw a polygon, make sure to have a few points that are close to the edge of the existing polygon on the map. When you are done drawing the polygon, either click on the polygon drwing button again or press the ESC biutton to end your drawing. Your polygon will then snap the edges of your polygon to that of the existing polygon.