The medial entorhinal cortex (MEC) is part of the brain's circuit for dynamic representation of self-location. The metric of this representation is provided by grid cells, cells with spatial firing fields that tile environments in a periodic hexagonal pattern. Limited anatomical sampling has obscured whether the grid system operates as a unified system or a conglomerate of independent modules. Here we show with recordings from up to 186 grid cells in individual rats that grid cells cluster into a small number of layer-spanning anatomically overlapping modules with distinct scale, orientation, asymmetry and theta-frequency modulation. These modules can respond independently to changes in the geometry of the environment. The discrete topography of the grid-map, and the apparent autonomy of the modules, differ from the graded topography of maps for continuous variables in several sensory systems, raising the possibility that the modularity of the grid map is a product of local self-organizing network dynamics.