We present a Simultaneous Localization and Mapping (SLAM) algorithm based on measurements of the ambient magnetic field strength (MagSLAM) that allows quasi-real-time mapping and localization in buildings, where pedestrians with foot-mounted sensors are the subjects to be localized. We assume two components to be present: firstly a source of odometry (human step measurements), and secondly a sensor of the local magnetic field intensity. Our implementation follows the FastSLAM factorization using a particle filter. We augment the hexagonal transition map used in the pre-existing FootSLAM algorithm with local maps of the magnetic field strength, binned in a hierarchical hexagonal structure. We performed extensive experiments in a ...