  In this paper we study the energy spectrum of a two dimensional electron gas
(2DEG) in a two dimensional periodic magnetic field. Both a square magnetic
lattice and a triangular one are considered. We consider the general case where
the magnetic field in a cell can be of any shape. A general feature of the band
structure is bandwidth oscillation as a function of the Landau index. A
triangular magnetic lattice on a 2DEG can be realized by the vortex lattice of
a superconductor film coated on top of a heterojunction. Our calculation
indicates a way of relating the energy spectrum of the 2DEG to the vortex
structure. We have also derived conditions under which the effects of a weak
magnetic modulation, periodic or not, may be reproduced by an electric
potential modulation, and vice versa.
