To achieve a good balance among the magnetic field intensity, region of homogeneous magnetic field intensity and cost, a magnetic field generating apparatus for generating a magnetic field in a vertical direction comprises: a pair of magnets having respective magnetic poles with mutually opposite polarities disposed to face each other in a vertical direction, for generating a static magnetic field having different dimensions of its region of homogeneous magnetic field intensity in two mutually orthogonal directions in a horizontal plane a pair of planar magnetic elements, each element supporting respective one of the pair of the magnets and a vertical columnar magnetic element lying in a direction different from the two directions, each end of which is joined to respective one of the pair of the planar magnetic elements.