code: def gridSnap(point, grid=1.0):
      
      def snapFunc(value):
          value += 0.000001 # ensure values that are close to a half grid value round up
          remainder = value%grid
          value -= remainder
          newAdd = round(remainder/grid)*grid
          return value + newAdd
      return MapPoint( snapFunc(point.x) ,
                       snapFunc(point.y) )
docs: cause the given point to snap to nearest X/Y grid point