Use a snapping grid
This sample shows how to use the snap grid manager when dragging HTML markers and/or while drawing shapes. Pass any shape into the
function or positions into the
function to get the snapped data from the current map view. A snapping grid makes it easier to draw shapes with shared edges and nodes, and straighter lines. The resolution of the snapping grid is in pixels. The grid is square and relative to the nearest integer zoom level. The grid scales by a factor of 2 relative to physical real-world area with each zoom level.