To address challenges associated with the traditional drill positioning method, which demands manual walking tracking and imposes stringent environmental conditions, this paper introduces an improved weighted centroid localization (WCL) algorithm based on multiple magnetic beacons. This algorithm alleviates the environmental requirements. Initially, a magnetic beacon measurement model immune to sensor attitude is formulated, followed by the development of a positioning model based on multiple magnetic beacons. The WCL algorithm is then introduced and refined for positioning with multiple magnetic beacons. Finally, the effectiveness of the proposed approach is validated through simulation experiments, revealing an average error of 0.632 m in large-scale positioning. This demonstrates clear advantages over traditional methods, making it highly applicable.