A Survey of Magnetic-Field-Based Indoor Localization

: Magnetic ﬁelds have attracted considerable attention in indoor localization due to their ubiquitous and infrastructure-free characteristics. This survey provides a comprehensive review of magnetic-ﬁeld-based indoor localization methods. We ﬁrst introduce characteristics of the magnetic ﬁeld, its advantages, and its challenges. We then describe the magnetometer model and the effect of ferromagnetic interference. We also present coordinate systems commonly used for magnetic ﬁeld localization and describe their transformation relationships. We then compare the existing publicly available magnetic ﬁeld benchmark datasets, present magnetometer calibration algorithms, and show how efﬁciently magnetic ﬁeld maps can be built. We also summarize state-of-the-art magnetic ﬁeld localization methods (e


Introduction
The global indoor positioning market size is expected to grow at a Compound Annual Growth Rate of 22.5% from USD 6.1 billion in 2020 to USD 17 billion by 2025.Major indoor positioning market vendors such as Zebra Technologies, Inpixon, Mist Systems, HID Global, Google, Microsoft, Apple, Cisco, and others are expanding their growth strategies through new product launches, partnerships and collaborations, and mergers and acquisitions for their presence in the global indoor positioning market [1].
While GNSS is challenging to meet indoor positioning requirements due to signal attenuation and obstacles, many alternative technologies and devices are used for indoor positioning, such as WiFi [2], Bluetooth [3,4], ultrasound or sound [5,6], visible light [7,8], and magnetic field [9,10].These indoor positioning technologies can obtain accurate location information and provide consumers with reliable location-based services and information.Common examples of location-based services include indoor navigation and tracking, marketing (shopping advertisements, proximity-based coupon sharing), entertainment (location-based social networking, location-based gaming), location-based information retrieval (e.g., pavilion tours, underground real-time information), and emergency and safety applications (e.g., emergency call, automotive assistance) [11,12].In particular, the use of geomagnetic positioning technology has attracted continued interest in academia [13,14] and industry [15,16] due to the popularity of smartphones, tablets, and personal digital agents (PDAs) with embedded magnetometers.As an emerging indoor positioning method, geomagnetic positioning uses the characteristics of the earth as well as local magnetic fields to achieve the goal of positioning with the advantages of achieving safety, reliability, and low cost without additional infrastructure requirement.
There are few surveys dedicated to magnetic field indoor localization technologies that focus on the challenges and advancement of geomagnetism-based indoor localization for smartphones [10,17] and the magnetic field matching algorithms [18].In addition, some significant advances in magnetic field localization techniques [19,20] have been proposed recently and have not yet been properly reviewed or recorded in these overview papers.
Hence, the purpose of this survey is to provide a timely and comprehensive overview and comparison of magnetic field localization techniques so that the reader can quickly gain an understanding of this research field.In addition to discussing the advantages and disadvantages of the various state-of-the-art methods, we also discuss the transformation of magnetic field coordinate systems related to earth, smartphone, and sensor coordinate systems.
To summarize, the main contributions of this paper are as follows: • This survey is structured as follows: Section 2 introduces the characteristics of a geomagnetic field and presents the advantage and challenges of using magnetic fields for localization.Section 3 presents the magnetometer model and related measurement distortions.Section 4 introduces the commonly used coordinate systems and their transformation in magnetic positioning.Section 5 explores several magnetic field benchmark databases.In Section 6, one presents the calibration techniques considered to correct the measurement distortions due to the imperfections of the used magnetometers.Section 7 reviews the magnetic field map construction techniques that are used by certain indoor localization methods.Section 8 introduces the taxonomy of indoor localization and gives a systematic review on the state-of-the-art indoor localization using magnetic landmarks, dynamic time warping, magnetic fingerprinting methods, filtering methods, simultaneous localization and mapping, and neural networks.Section 9 summarizes the smartphone-based pedestrian dead reckoning algorithm.The advantages and disadvantages of magnetic field signals are compared with other fingerprints, their practical applications are reviewed, and the challenges and prospects for magnetic field applications are summarized in Section 10.Finally, Section 11 concludes the survey of magnetic-field-based indoor localization.

Overview of the Geomagnetic Field
The geomagnetic field refers to the magnetic field that extends from the Earth's interior into space and has the effect of a barrier against the charged particles carried by the solar winds.The magnetic field follows currents generated by convective motion caused by the heat escaping from the core of a mixture of molten iron and nickel in the Earth's outer core.The size of the magnetic field at the Earth's surface ranges from 25 to 65 µT (T stands for Tesla) [21].As shown in Figure 1, the north geomagnetic pole is located at the south pole of the Earth, and the south geomagnetic pole is located at the north pole of Earth.The magnetic axes of the two poles are tilted at approximately 11.3 degrees to the Earth's rotation axis as if a giant bar magnet has been placed at this angle at the center of the Earth (red in Figure 1).

Geomagnetic Field Characteristics
The geomagnetic field is a three-dimensional vector with three orthogonal magnetic field components: X, Y, and Z.It can be expressed by m = (m x , m y , m z ). Figure 2 illustrates the magnetic field vector, and H is the horizontal field component.The declination, D, is the angle between the geographic north and H.The inclination, I, is the angle between the total geomagnetic field intensity, F, and the horizontal plane [23,24].From Figure 2, we can easily obtain the equations for F, D, I, and m x , m y , m z as follows:

Geographic North
(1) For decades, researchers have known that homing pigeons, migrating birds, sea turtles, lobsters, and other species can somehow sense the Earth's magnetic field to determine the direction they are traveling [25][26][27][28].Spatial discrimination and temporal stability are two key characteristics that make up a good fingerprint [13,29,30].In this section, we describe the geomagnetic field and summarize some of the characteristics of indoor magnetic field measurements-some of which are beneficial for indoor positioning, while others pose challenges for practical applications.

Advantages of Using Magnetic Field Measurement
Compared with WiFi [2], Bluetooth [3,4], ultrasound or sound [5,6], and visible light [7,8], magnetic field positioning has the advantages of temporal stability, uniqueness due to ferromagnetic disturbance, and tolerance to moving objects.

•
Temporal stability: The temporal stability of the magnetic field measurement is an important characteristics.A lot of studies are reported in the literature on the temporal stability of magnetic field measurement [17,19,20,[31][32][33].The results of the current study show that magnetic field measurements are stable over time or vary slowly when no significant infrastructural changes are introduced in a given indoor environment.

•
Uniqueness due to ferromagnetic disturbance: The ubiquitous magnetic field is disturbed by the ferromagnetic materials, such as steel or iron used in buildings, which distort the magnetic field measurements [17].These disturbances cause the compass heading to fluctuate, resulting in incorrect direction and position information [34].Haverinen et al. [13] collected indoor magnetic fields through the robot with embedded sensors indicating the presence of pillars, doors, and elevators in the room, making the magnetic field measurements more unique, so they can be utilized as a solution for indoor positioning.Subbu et al. [33] analyzed the cause for this uniqueness and then proposed a solution for indoor positioning by classifying the patterns of magnetic field measurements.Ashraf et al. [17] studied the effect of building materials on magnetic field data, provided a comprehensive analysis of the nature of the building, and discussed the variation of magnetic field disturbances.

•
Tolerance to moving objects: The effect of moving objects, such as people or cabin, on the magnetic field is very limited and almost non-existent at a distance of 1 m.The authors of [31] studied the influence of moving objects, such as people, cabin, elevator, and electrical appliances, on the magnetic field in typical situations and showed that elevator infrastructure had a significant influence on the magnetic field measurement, whereas the moving cabin had little impact.Experiments given in [17] show that human mobility has no or a small effect on magnetic field measurements, and the addition of furniture in the indoor environment that does not contain ferromagnetic materials has no substantial impact on the magnetic field local signature.Since the signals in indoor environments are more complex than in outdoor environments.The reflection, diffraction, and scattering effects of wireless signals in media with different propagation characteristics (such as walls, floors, pedestrians, and other objects) can cause the attenuation of Wifi signals [35][36][37].This highlights the huge advantages of magnetic positioning.

Challenges of Using Magnetic Field Measurement
The challenges of using magnetic fields for indoor localization mainly include the effects of low discernibility and smartphone heterogeneity, which affect the performance of localization.

•
Low discernibility of magnetic field measurement: The magnetic field intensity at the Earth's surface smoothly varies between 25 µT and 65 µT [21].In a given indoor environment, the MF is affected by the local environment, leading to slight differences in the MF signature (measurement) at different indoor locations.However, almost identical magnetic field measurements might occur at different indoor locations, which leads to a low discernibility problem when using MF maps for the indoor location.

•
Need for frame transformation: The geomagnetic vectors in the navigation frame and the smartphone frame are denoted as m n ∈ R 3×1 and m b ∈ R 3×1 , respectively.As the heading of the smartphone may be random in the coordinate navigation system, readings must be measured in different directions at each location [14], which is costly in terms of time and labor and prone to noise.In order to make the magnetic field measurements of the smartphones consistent, it is necessary to transform m b in the smartphone framework to m n in the navigation framework.However, the frame transformation process requires information from the gyroscope and accelerometer to obtain the rotation matrix, and it is a challenge to calculate the accurate rotation matrix.Suppose tilt information is available for the smartphone, we can use the TRI AD [38] method to transform the geomagnetic field on the smartphone's frame into the horizontal (denoted as m h ) and vertical (denoted as m v ) components [32].After the transformation, the horizontal and vertical components are 'ideally' independent of the user's direction.Unfortunately, in practice, this is not the case because the accelerometer measurements (and hence the frame transformation) are affected during walking.

•
Challenge with the use of MF intensity only: Note that, although the three-dimensional magnetic field measurements will be inconsistent when the smartphone is oriented differently, the magnetic field intensity m b is the same [33].However, compared to using the MF vector m b , the magnetic field intensity m b is a scalar, which loses a large amount of information and can lead to a decrease in localization accuracy.
Recent methods such as MaLoc [14] combine |m b |, m h , and m v to form a 3D vector for indoor localization.However, due to the m b = m 2 h + m 2 v , the 3D vector does not provide more information than the 2D measurement and therefore does not increase the localization performance.

•
Heterogeneous Device: It is important to design a positioning method that can seamlessly integrate with the magnetic field of various smartphones.The major smartphone companies such as Apple, Samsung, Huawei, Xiaomi, etc., use embedded magnetometers from various manufacturers.There is no one standard for selecting embedded magnetometers for smartphones.The embedded magnetometer models used by the various smartphone companies have specific sensitivities and noise tolerances, resulting in their magnetic field measurements also varying.Table 1 shows the names and descriptions of the various magnetometers added to smartphones.Several major smartphone manufacturers have chosen different magnetometer models, and the sensitivity and operating temperature characteristics of these magnetometers are not exactly the same, resulting in different magnetic field measurement readings.Therefore, calibration is required before using the magnetometer.According to the Android documentation, rotating your smartphone in figure-of-eight swings calibrates the magnetometer measurement [39].However, this simple calibration method does not meet the needs of magnetic field localization.The two main calibration methods mentioned in recent literature are ellipsoid fitting [40] and maximum likelihood estimation [41].When the user walks indoors, the smartphone can obtain a geomagnetic measurement sequence, and the geomagnetic measurement sequence can improve the accuracy of positioning more than a single measurement [42,43].Magnetic field sequence measurements show similarity between heterogeneous smartphones [17].Using the Dynamic Time Warping (DTW) method, finding the minimum in the adjacent cumulative differences and calculating the cumulative distance is possible [44].Variations in magnetic field data are caused by magnetic materials in the surrounding environment [10].Smartphone calibration is required for each indoor environment in which positioning is performed.

Magnetometer Measurement Model
The magnetometer measures the magnetic field intensity along the sensor's X, Y, and Z axes.The geomagnetic vector m n ∈ R 3×1 is a vector in navigation frame n aligned with the Earth's gravity and the local magnetic field.Vector m b ∈ R 3×1 is in the sensor frame b.R bn ∈ R 3×3 is a rotation matrix that indicates the transformation from the navigation frame n to the body frame b: In an outdoor environment, the local geomagnetic field is equal to the local Earth's magnetic field.Its horizontal component points to the magnetic north pole of the Earth [51].The ratio between the horizontal and vertical components depends on its position on the Earth and can be expressed in terms of the inclination angle δ.
In the absence of any magnetic interference, rotating the magnetometer in all possible directions, the MF measurement is located on a sphere with a radius of the magnetic field intensity.However, indoor magnetic measurements may be affected by interference with the surrounding environment.Noise sources and instrument error degrade a magnetometer's measurement.Noise sources result in two kinds of distortion.Metals such as nickel and iron could cause a soft iron effect, which distorts the sphere into an ellipsoid, as shown in the plot of Figure 3a.We model this distortion as A si ∈ R 3×3 .The hard iron effect b hi ∈ R 3×3 is produced by materials that exhibit a constant additional field to the Earth's magnetic field, as shown in Figure 3b.This distortion shifts the origin of the ideal magnetic measurement sphere.
With hard iron and soft iron effects, the magnetometer measurement model can be written as: Instrumentation errors in magnetometers contain scale factors S, misalignment errors M, and sensor bias b so , which are unique and constant for a specific magnetometer [40]:

•
The scale factor S ∈ R 3×3 represents the difference in sensitivity of the three axes, where s x , s y , and s z denote the scale factor of sensors' x, y, and z axis.

•
The matrix M ∈ R 3×3 indicates the misalignment errors of sensors which is given by in which ε x , ε y , and ε z denote the error of sensor's x, y, and z axis in the sensor frame, respectively.

•
The vector b so ∈ R 3×1 shows the bias in sensors b so = b so z b so y b so z .
Thus, the complete magnetometer measurement model is written as follows: where m n is the local magnetic field, m b is the readings from the tri-axis magnetometers in the sensor frame.ε is an i.i.d Gaussian noise from N 0, σ 2 ε I .It is not necessary to identify all the components of Equation (10).Expanding Equation (10), the scale factor, misalignment, and soft iron distortion can be combined into a distortion matrix A ∈ R 3×3 , and the hard iron effect and sensor bias can be formed into an offset vector b ∈ R 3×1 .
The magnetometer measurement model can be expressed as:

Coordinate Systems and Transformations
There are several common coordinate systems used in inertial navigation.We summarize the coordinate systems in this section:

•
The earth-centered earth-fixed (ECEF) coordinate system; • The geodetic coordinate system; • The local East-North-Up (ENU) coordinate system; • The smartphone coordinate system; • The 9 degrees of freedom sensor coordinate system.
The relationships among these coordinate systems and the coordinate transformations are also introduced.

Earth-Centered Earth-Fixed
The Earth-Centered Earth-Fixed (ECEF) coordinate system is a Cartesian coordinate system with the center of the earth as its origin, as shown in Figure 4.The X axis passes through the Equator and Prime Meridian intersection.The Z axis passes through the North Pole.The Y axis is orthogonal to X and Z.As a result, this coordinate system rotates with the earth.The distances used along each axis are meters.The position vector in the ECEF frame is denoted by

Geodetic Coordinate System
The geodetic coordinate system (see Figure 4) is widely used in GNSS-based navigation.It is a system that describes coordinate points close to the Earth's surface in terms of latitude φ, longitude λ, and altitude h, respectively.Latitude measures the angle (ranging from −90°to 90°) between the equatorial plane and the normal to the reference ellipsoid passing through the point being measured.Longitude measures the angle of rotation between the principal meridian and the measured point (ranging from −180°to 180°).Altitude is the local vertical distance between the measured point and the reference ellipsoid.
The WGS 84 (World Geodetic System 1984) datum defines the Earth's surface as an oblate ellipsoid with an equatorial radius a.An ellipsoid is a three-dimensional surface created by the rotation of an ellipse around its short axis.The shape of the ellipsoid can be described by the equatorial radius or semi-major axis a, the polar radius or semi-major axis b, the flattening f , and the first eccentricity squared e.

•
Equatorial semi-major axis: • Flattening: • Polar semi-minor axis: • First eccentricity squared: the position vector in Geodetic coordinates could be denoted by where φ represents the geodetic latitude, λ represents longitude, and h represents the ellipsoidal height, which can be converted into ECEF coordinates using the following Equation [52]: where N(φ) is the prime vertical radius of curvature defines as: a and b are the equatorial radius (semi-major axis) and the polar radius (semi-minor axis), respectively.e 2 = 1 − b 2 a 2 is the square of the first numerical eccentricity of the ellipsoid.The prime vertical radius of curvature N(φ) is the distance from the surface to the Z-axis along the ellipsoid normal.

Local East-North-Up Coordinate System
The local ENU coordinate system is a coordinate frame fixed to the earth's surface.Based on the WGS 84 ellipsoid model, its origin and axes are defined as shown in Figure 4: For a position vector that is given in ECEF coordinates, ENU coordinates can be transformed by multiplication with a rotation matrix.

Smartphone Coordinate System
A standard smartphone coordinate system is shown on the right-hand side of Figure 5. X axis is horizontal and points to the right.Y axis is vertical, and Z axis points to the sky.Using a smartphone for mapping and real-time positioning usually does not require considering the transformation between sensor frames and device frames, but if you use an embedded robot for mapping and then use a smartphone for positioning, you need to consider the transformation relationship between the sensor frames and device frame.Figure 5 shows the transformation of the sensor frame to the smartphone frame.

Nine-DOF Sensor Coordinate System
A sensor with nine degrees of freedom (9DOF) is often used in navigation robots (e.g., LSM9DS1), which contains a three-axis accelerometer, three-axis gyroscope, and three-axis magnetometer, but the coordinate systems of the accelerometer, gyroscope, and magnetometer are not the same.As shown in Figure 6, the coordinate systems of the accelerometer and gyroscope are the same, while the magnetometer is different from the other two, but they all have a left-hand rule relationship [53,54].

Magnetic Field Benchmark Datasets
Building geomagnetic databases are time-consuming and laborious, and it is significant to provide some publicly available geomagnetic databases for researchers to compare the state-of-the-art algorithms.However, there are some public magnetic field datasets for which the links are no longer available due to a lack of maintenance by the authors.This section presents several magnetic field datasets that are still accessible as of March 2022 and serve as a benchmark for many research papers.
1. MagWi (accessed date: 7 March 2022) dataset was presented by [55] in 2021 It provides essential features of Wi-Fi and magnetic field data.Besides Wi-Fi and magnetic field, inertial measurement unit (IMU) data are provided from the accelerometer, motion sensors, and barometer involving four users, both male and female.The dataset can be used to study the effects of device heterogeneity, spatial diversity, smartphone orientation, walking speed, time-related mutations, and the impact of human movement on Wi-Fi and magnetic field measurements.Over nearly five years, the dataset was collected using five different smartphones, including Galaxy S8, LG G6, Galaxy A8, LG 7, and Galaxy S9+.

Magnetometer Calibration
Magnetometers are necessary auxiliary sensors for attitude estimation in low-cost, high-performance inertial navigation systems.The inexpensive, low-power magnetometers allow accurate attitude estimation by comparing magnetic field vector observations in body coordinates with magnetic field measurements in the Earth coordinate.The fusion of magnetometer and inertial sensor information leads to accurate 3D attitude estimation [60,61].The accuracy of 3D attitude estimation is closely related to the calibration of the sensor measurements and the interference [62].Magnetometers are more sensitive to environmental changes than inertial sensors and require more frequent recalibration [41].The calibration of magnetometers could be divided into two methods: attitude-dependent and attitude-independent.
The classical compass swing calibration method presented in [63] is a heading calibration algorithm that requires leveling and an external known heading source and keeps the magnetometer plane level.This method is attitude-dependent.
In recent years, attitude-independent calibration methods have been explored in the literature.The TWOSTEP batch method was proposed in [64] to estimate magnetometers' bias with an unknown attitude.In the first step of the algorithm, the initial predictions of the calibration parameters are obtained by a centering approximation method to solve the resulting quadratic objective function.The second step estimates the parameters by a batch Gaussian-Newton iterative estimation method system.Crassidis et al. [65] compared three recursive magnetometer calibration algorithms: the sequential centering algorithm, the extended Kalman filter (EKF), and the Unscented filter (UF).Among them, the sequential centering algorithm is a linear least-squares method based on the centering approximation.The experimental results show that the EKF and UF algorithms have smaller residual magnitudes and mean residuals closer to zero than the sequential centering algorithm.The UF algorithm is more robust than the other two algorithms in terms of accuracy and convergence properties.
The goal of the calibration method is to estimate the calibration parameters A and b in Equation ( 13).The batch magnetometer calibration method uses the entire set of magnetic field measurements to estimate the unknown calibration parameters [66], using an attitudeindependent observation to estimate the magnetometer error term.This observation is derived from the fact that the magnetometer measurements are constant and independent of the attitude of the local measurement position [67].The cost function is constructed from the difference between the measurement model of the magnetometer and the true geomagnetic measurements.The calibration parameters are estimated with the maximum likelihood method.In [68], the calibration is considered a parametric optimization problem formulated through maximum likelihood estimation (MLE), and the optimization algorithm is derived using the gradient and Newton descent method.The sensor alignment matrix is obtained through the solution of the orthogonal Procrustes problem.The initial conditions of the iterative algorithm are obtained with suboptimal batch least-squares calculations.
Approximate MLEs are sensitive to initial errors, and inaccurate initial estimates can lead to magnetometer calibration failure.Wu et al. [67] proposed an optimal MLE magnetometer calibration algorithm based on a quadratic method.Compared with the approximate MLE method, the optimal MLE calibration has advantages in terms of accuracy and stability, but the computational cost of the optimal MLE calibration is relatively high.Kok and Schön in [41] transformed the calibration algorithm into a maximum likelihood problem by using ellipsoid fitting to obtain the initial values of the calibration parameters, then using the extended Kalman filter (EKF) to calculate the rotation matrix and the accumulated errors, and finally constructing the cost function.References [69,70] proposed a particle swarm optimization (PSO) algorithm to solve the parameter estimation problem in magnetometer calibration.PSO is a global optimization algorithm that transforms the calibration problem into a parameter optimization problem.The PSO-based calibration algorithm has the advantages of no initial values and linearization, easy implementation, and fast convergence.Classical iterative solutions are based on the approximation of the gradient to find the minimum of the cost function.Tahir et al. [71] transformed the magnetometer calibration model into a stochastic optimization problem using a modified simultaneous perturbation stochastic approximation (SPSA) method for gradient estimation, giving similar calibration results to the PSO-based method but with much less computational complexity.These methods were implemented by minimizing the difference between the measured magnetic field and the local reference magnetic field [72], which was denoted as scalar checking.The scalar checking methods assume that the local magnetic field is stable during calibration and rotate the measured magnetic field to an arbitrary direction to minimize a certain scalar cost function.However, the scalar checking method for magnetometer calibration has the problem of rotational ambiguity.The calibration model in Equation ( 13) conforms to the ellipsoidal limit, and the calibration matrix cannot be fully determined because the ellipsoidal parameters are fewer than the calibration model parameters.To explain the rotational ambiguity problem from mathematical principles, the calibration matrices derived from the ellipsoid coefficient matrix by different matrix decomposition methods are not unique, and there exists an unknown rotation matrix R ∈ R 3×3 between them [73].
Table 3 summarises mentioned calibration algorithms' accuracy, robustness, computational cost, and deployment difficulty.The deployment of magnetometer calibration algorithms needs to consider device dependencies, smartphone heading, and the effects of environmental noise.Smartphone battery consumption is closely related to the complexity of the magnetometer calibration algorithm.

Magnetic Field Map Construction
Indoor maps are a prerequisite for indoor positioning systems.Hiring experts to build indoor maps and update them regularly is an expensive and time-consuming method that cannot be applied to large-scale indoor coverage.In recent years, researchers have proposed some crowdsourcing and SLAM-based methods to construct indoor floor plans [74].Unlike traditional expert site surveys, crowdsourcing is an approach that uses crowd contributions to achieve complex tasks and is well suited for fingerprint-based indoor locations [75].

Traditional Map Survey
He et al. [31] proposed a compliant-walking-based site survey method: the surveyor places the smartphone in a fixed body position and walks along a pre-planned measurement path from the starting point to the endpoint.The smartphone records the accelerometer, gyroscope, and magnetometer readings during the walk.The estimated actual user trajectory is matched to the pre-planned path to determine the location of each step.The positions of the collected magnetic signals are interpolated from the positions of adjacent steps.

Crowdsourcing Approaches
Crowdsourcing-based localization systems typically have lower localization accuracy than the systems based on explicitly surveyed fingerprint data.Table 4 depicts the comparison of localization accuracy based on geomagnetic field crowdsourcing methods.Mobile crowdsourcing methods do not require pre-labeled reference points and manual calibration and are becoming an attractive way to construct magnetic field maps [76].When building fingerprint databases using crowdsourcing approaches, location estimates from the PDR method are often used as the location labels for the measurement data [77].MeshMap is an indoor positioning system based on magnetic fields and crowdsourcing [78].A magnetic fingerprint database is constructed by merging sensor data from different paths of multiple users using a crowdsourcing approach.In order to combine magnetic navigation maps, a dynamic time warping-based matching algorithm is developed for map stitching, overlapping region checking, magnetic field time series matching, and position correction.A cubic spline interpolation algorithm is used for the purpose of robustness.It is reported that 70% of the time, the navigation error is within 2 m, and 95% of the time, it is within 4 m.The accuracy of the dead reckoning method is affected by the accumulation of errors due to sensor noise, and the accuracy of the constructed floor plans of indoor paths usually inferred from only one dead reckoning trajectory is low.Luo et al. [74] proposed a crowdsourcing method to collect data from magnetometers, gyroscopes, and accelerometers in smartphone.Magnetic anomalies caused by magnetic materials in modern buildings were applied to the system as a unique index.PDR techniques, magnetometer measurement models, and trajectory fusion based on affinity propagation algorithms are used.Magnetic trajectory data were clustered using dynamic time-warped similarity criteria.It is reported that an indoor map with an accuracy of 0.48 m was successfully constructed.Ayanoglu et al. [79] proposed an automatic FingerPrinting (FP) map construction algorithm based on many user trajectories.This crowdsourced approach utilizes only the inertial sensors of mobile devices and does not require specialized infrastructure or floor plan information.Overlapping of multiple user trajectories can be identified by clustering magnetic field measurements and heading features at the detected turns.These clusters are used as landmarks in the map construction process, and the trajectory information between the landmarks can iteratively update the locations of the landmarks.

Mapping with Simultaneous Localization and Mapping
PFSurvey was proposed in [80] for the rapid creation of signal maps that could be used to survey an entire building in a matter of minutes.The method uses accelerometer, gyroscope, and magnetometer data to estimate the surveyor's trajectory and uses SLAM and particle filters to incorporate a floor plan of the building, achieving trajectories within 1.1 m of ground truth in 90% of the time.Compared to maps generated by traditional time-consuming manual surveys, PFSurvey's data collection costs are lower, but it achieves similar accuracy.

Geomagnetic Field Interpolation
Interpolation is a technique for adding new data points to a set of known data points and is commonly used to fill in missing magnetic field data in indoor positioning algorithms based on magnetic field positioning.Suppose the user's location is within the localization area, but the magnetic field data are missing at that point.The magnetic field measurement can be computed using the magnetic field data points close to the query point.
The Gaussian Process (GP) is a powerful nonlinear interpolation method, and many standard interpolation methods are equivalent to a specific Gaussian process.Assume that the geomagnetic field m ∈ R 3×1 can be modeled by three independent Gaussian processes [81], and then the model is generalized as a multivariate normal distribution given by where µ ∈ R 3×1 is the mean vector, and K ∈ R 3×3 is the covariance function given by where σ 2 i is a variance hyperparameter, and l 2 is a length scale hyperparameter.x and x represent two different points on the continuous domain of the Gaussian process; x − x 2 is the distance between x and x ; the output of function K represents the covariance value between the Gaussian distribution represented by x and x -the larger the distance, the smaller the correlation between the two distributions.
Vallivaara et al. [82] proposed a simultaneous localization and mapping (SLAM) method based on local anomalies of an ambient magnetic field using a Rao-Blackwellized particle filter to estimate the pose distribution of the robot and a Gaussian process regression to simulate the magnetic field map.This method demonstrated that geometrically consistent magnetic field maps can be generated using odometer and magnetic field mea-surements.However, this work was only tested in a small area, and based on this, Akai and Ozaki [83] used a mobile robot to collect magnetic data and efficiently built large-scale magnetic maps using GP.Wahlström et al. [84] introduced a Bayesian nonparametric model based on a vector-valued stationary Gaussian process to estimate the magnetic field and the magnetic source jointly.The divergence and curl-free properties of the magnetic field from electromagnetic theory were exploited to calculate its covariance function.Solin et al. [85] presented a Bayesian nonparametric probabilistic modeling approach for the interpolation and extrapolation of magnetic fields.By imposing a GP on the potential scalar of the magnetic field, the magnetic field components are jointly modeled using Maxwell's equations, providing a model for the ambient magnetic field that allows continuously updating the estimates and the time variation of the magnetic field.Kok et al. [86] combined the physical properties of the magnetic field with a Gaussian process model to represent the magnetic field map and uses three-dimensional hexagonal block maps to create local maps.Reduced-grade Gaussian process regression combined with Rao-Blackwellized particle filters make the computation tractable.The approach provides a scalable magnetic field SLAM algorithm for computational complexity and map storage.

Indoor Localization Methods Using Magnetic Fingerprints
Fingerprinting is a common location method that works by matching fingerprint measurements to fingerprints in a database to estimate the location of an object.The accuracy of magnetic fingerprint localization can be affected by smartphone orientation and environmental changes.In addition, magnetic field localization accuracy depends on fingerprint density, and the acquisition and maintenance of high-quality magnetic maps is a time-consuming and labor-intensive process [87].Compared with other methods, it has relatively low complexity and high applicability in complex indoor environments [2].Fingerprinting consists of two phases: training and offline [88].In the training phase, a fingerprint database of a certain granularity is built in the region of interest.The finer the granularity, the higher the accuracy, while the time and labor costs increase.In the offline phase, the collected measurements are matched with the fingerprints in the database using deterministic algorithms or probabilistic algorithms [18] to calculate the location of the object.There are some popular magnetic fingerprinting-based positioning algorithms using pattern recognition techniques.Figure 7 summarizes the research on indoor localization based on magnetic field fingerprinting, and we will follow this scheme to discuss magneticfield-based localization methods.This section will first discuss how local geomagnetic anomalies of landmarks can be used to determine target locations in Section 8.1.We then discuss how to use dynamic time warping for position matching in Section 8.2.We next examine machine-learning-based magnetic fingerprinting methods in Section 8.3.Then, we discuss filter-based methods for magnetic field localization in Section 8.4.We then discuss the magnetic field localization with Simultaneous Localization and Mapping in Section 8.5.Finally, we discuss the application of (deep) neural networks to magnetic field localization in Section 8.6.

Magnetic Landmark
Landmarks are defined as location points in indoor environments where at least one type of sensor data presents a distinctive, stable, and identifiable pattern [89][90][91].The survey [92] provides a comprehensive review of landmarks localization methods.Landmarks can be categorized as seed landmarks and organic landmarks [89,90], as shown in Figure 8. Seed landmarks correspond to landmarks at physical points in the environment, including stairs, lifts, escalators, etc. Seed landmarks have a unique impact on one or more mobile phone sensors and can be uniquely detected.Organic landmarks (such as WiFi landmarks, magnetic landmarks, and inertial sensor landmarks) do not correspond to specific objects and are usually detected based on their unique signature on the sensor [90].Devices, such as fridges, lifts, metal doors, etc., can make the magnetometer readings show prominent variations and be used as magnetic landmarks.Magnetic landmarks can be used to enhance indoor positioning and mapping [89,90,93], to detect indoor/outdoor environments [94], and to label the semantics of indoor environments [95].There are several research works that utilize landmarks to enhance indoor localization.An early system using landmarks for indoor localization is UnLoc [89], which achieves a median localization error of 1.69 m by combining PDR with landmarks.SemanticSLAM [90] further extends the UnLoc system using the SLAM technique, which decreases the median localization error to 0.53 m.An activity landmark-based indoor mapping system is presented in [96], which is called ALIMC.By detecting the activity landmarks, ALIMC achieves a mapping accuracy of about 0.8-1.5 m within the 80th percentile.APFiLoc [93] uses a particle filter to fuse PDR, landmarks, and a floor plan, which achieves a localization accuracy of less than 2 m with 80% confidence.Specific methods for identifying seed landmarks are presented in [97].For example, turns can be identified using angle-or direction-dependent sensors.Lifts can be easily identified based on unique patterns of vertical acceleration data.The acceleration pattern of taking the escalator is similar to a stationary state.The acceleration pattern for going up or down the stairs is similar to regular walking.The door landmarks contain two phases of acceleration: the low value of opening the door and the periodic pattern of walking out.Subbu et al. [33] distinguished corridors with success using magnetic signatures resulting from different components or sources of interference in the room, such as pillars, doors, and lifts.Landmark-based localization also has some limitations.Firstly, landmark detection.Existing work typically involves manually designing detection features and setting thresholds for detecting different landmarks through empirical analysis, which may vary from scene to scene.There is no general method to learn useful landmark detection features automatically.Secondly, the problem of data association is to be considered, i.e., determining the correct landmark when there are multiple landmarks nearby.Thirdly, the omission problem, i.e., certain landmarks, may be missed in some cases.For example, a door landmark can be missed if the door is open because most door detection methods assume that the user performs a series of activities while passing through the door (e.g., walking-standing and opening the door-walking) [98].

Dynamic Time Warping
Dynamic Time Warping (DTW) has many applications in magnetic field localization by compressing or stretching the time axis of one (or both) magnetic field sequence(s) to align two magnetic field sequences with similar patterns but with differences in amplitude and time.Subbu et al. [44] used DTW to classify magnetic signatures collected from different corridors.By aligning unknown magnetic signatures with known signatures, the technique can obtain a close match between test and specific magnetic signatures that vary in time, thus providing the correct corridor/location information.Wang et al. [77] used backward magnetic fingerprints synthesized from magnetic fingerprints collected online in the forward direction to improve localization accuracy.Assessed through the DTW that the synthetic backward magnetic trajectories were similar to the actual backward magnetic observations.In this way, we can obtain more magnetic trajectories for localization.Li et al. [99] proposed a localization method (CSMS) that integrates channel state information (CSI) and magnetic field strength (MFS).The CSMS constructs an integrated fingerprint map of CSI and MFS.The initial localization coordinates are first obtained according to the M-KNN algorithm in the localization phase.Then, the Local Dynamic Time Warping algorithm is applied to match the geomagnetic sequence during the motion for tracking.Finally, according to the tracking position, the Multi-Module Data k-Nearest Neighbor algorithm dynamically weighs the multi-module data to narrow down the localization range and perform fingerprint matching to obtain more accurate localization results.DTW usually calculates the distance between the measured magnetic field and the magnetic fingerprint in the database.Based on the traditional DTW, Chen et al. [100] proposed an improved DTW (3DDTW) that extends the one-dimensional input signal into a two-dimensional one.Then, 3DDTW was used to calculate the distance between the measured magnetic field and the magnetic fingerprint, thus reducing the mismatch of the magnetic fingerprint.Finally, weighted least squares were used to reduce indoor positioning errors with a hybrid positioning accuracy of approximately 3.3 m.

Machine Learning Approaches
With the development of artificial intelligence, machine-learning-based indoor positioning is becoming a trend, and machine learning algorithms can effectively address many of the limitations of traditional positioning techniques for indoor environments.The most important advantage of the machine learning approach is its ability to learn helpful information from input data with known or unknown statistics [101].
In machine-learning-based localization, classifier algorithms such as K-NN [102], support vector machines (SVM) [103], naive Bayes [104], decision trees [105], and discriminant analysis [106] are widely used to extract the core features of a signal.Localization methods need to consider accuracy and computational complexity, and acquiring high-dimensional data through feature engineering to improve accuracy can introduce high computational complexity.Dimensionality reduction techniques such as principal component analysis (PCA) [107] and singular value decomposition (SVD) [108] techniques can transform highdimensional features into low-dimensional ones, significantly reducing the storage space and computational complexity of magnetic fingerprint-based localization.
The architecture of a magnetic-based positioning system is shown in Figure 9.The system consists of two phases: online and offline.First, raw magnetic data are collected at a reference location using a smartphone.Then, during pre-processing, low-pass filters, smoothing filters, and calibration algorithms are applied to remove noise and bias from the smartphone's magnetic measurements.Subsequently, the combined pre-processed data generates a fingerprint database corresponding to each location.The fingerprint database is trained using machine learning methods (e.g., kNN, support vector machines, decision trees, naive Bayes, discriminant analysis) to obtain predictive models.Finally, a prediction model is used to predict the test data's position.We will focus on fuzzy kNN, support vector machines, decision trees, naive Bayes, and discriminant analysis in the following.
Fuzzy K-nearest neighbor: Fuzzy K-nearest neighbor algorithm [109] is a well-known algorithm for classification.The theory of fuzzy sets was introduced into the k-nearest neighbor technique to develop a fuzzy version of this algorithm called fuzzy-k-nearest neighbor.Not only does the fuzzy algorithm have the advantage of a lower error rate, but the resulting membership also provides a confidence level in the classification.Fuzzy-knearest neighbor was shown to perform well compared to other more complex classification algorithms.The principle of the algorithm is to assign membership as a function of the Euclidean distance vector from the basic k-nearest neighbor algorithm and memberships in the possible classes.The algorithm is defined as follows: Given a location of magnetic training set, X = {x 1 , x 2 . . .x n | x i ∈ R m } collected from n points in the test area with m features.The second magnetic test set contains, Z = {z 1 , z 2 . . .z n | z i ∈ R m } from n points.We compute the metric where j = 1, 2 . . ., k, in which k is number of nearest neighbors, and i = 1, 2 . . ., n, in which n is the number of points.The fuzzy parameter m is used to determine the weights of the distances.Here, we set m = 2. Decision tree: A decision tree is a non-parametric supervised learning technique consisting of multiple decision rules, all of which are derived from data features.In a decision tree, we call the whole sample the root node, and the process of dividing a node into two or more sub-nodes is called splitting.When a sub-node splits into more sub-nodes, it is called a decision node.Nodes that do not split are called leaves.The process of deleting the sub-nodes of a decision node is called pruning.The decision tree algorithm splits the training set (root node) into subsets, recursively splitting until no pure sub-nodes (leaf nodes) are obtained.The decision tree algorithm requires optimal attributes and thresholds that maximize the splitting criteria (e.g., CART Tree), and the resulting set of splits is optimal.Commonly used decision tree models such as the CART algorithm use Gini's impurity index, the ID3 algorithm uses Information Gain, and the C4.5 algorithm uses Gain Ratio [105].
Naive Bayes: The Naive Bayes classifier is based on Bayes' theorem.Suppose X = {x 1 , x 2 . . .x n | x i ∈ R m } has n samples with m features, class labels y = {y 1 , y 2 . . .y k }.According to Bayes' rule, P(y i | x) can be expressed as where P(y i ) and P(x) are known.To estimate the location, we need to find the corre- sponding location y i that maximizes P(x | y i ).Since the magnetic values obey a Gaussian distribution, i.e., P(x | y i ) ∼ N (µ, σ 2 ), µ and σ are derived from the training set [104].
Discriminant analysis: Discriminant analysis methods are well known for learning discriminative feature transformations and can be easily extended to multiple class cases [110].Suppose we have training data X = {x 1 , x 2 . . .x n | x i ∈ R m } , n samples with m features, class labels y = {y 1 , y 2 . . .y k }.The within-class scatter matrix given as: where µ i = 1 l i ∑ x∈y i x and l i is the number of samples in y i .The between-class scatter matrix equation is defined as where l i is the number of training samples for each class, µ i is the mean for each class, and µ is total mean vector given by µ = 1 l ∑ n i=1 l i µ i .The Fisher criterion suggests that the linear transformation w maximizes the ratio of the determinant of the between-class scatter matrix of the projected samples to the within-class scatter matrix of the projected samples [106].
The transformation w can be obtained by solving the generalized eigenvalue problem [110]: Support vector machine: Support vector machine classifies data by finding the best hyperplane, which is the hyperplane with the maximum distance between two classes.Given n samples of training data X = {x 1 , x 2 . . .x n | x i ∈ R m } with m features, labels y = {y 1 , y 2 . . .y k }.The i-th SVM is trained using all examples with positive labels in the i-th class and all other examples with negative labels, and the i-th SVM is formulated as follows: where the training data x i are mapped to a higher dimensional space by a function f , w ∈ R m is a vector representing the direction of the separated hyperplane, b ∈ R is a constant representing the position of the hyperplane, C is the penalty parameter that defines the trade-off between large separation regions and misclassification errors, and ξ i j is slack variable that allows some samples to be on the wrong side of the separation hyperplane [111][112][113].
After solving Equation (31), there are the decision functions: x belongs to the class with the largest value of the decision function.
K-NN is widely used for pattern-matching magnetic fingerprinting.However, K-NN has poor performance in handling large datasets and high-dimensional datasets.Fingerprinting approaches such as support vector machines [114] and linear discriminant analysis [115] have been shown to improve localization accuracy while increasing the computational cost.The main challenge of deterministic methods is that although some sampling points are spatially close, their magnetic field similarities are farther apart, leading to significant localization errors.Huang et al. address this problem using the multidimensional scaling (MDS) method in [116].Support vector machine employs a kernel mechanism to find the differences between two classes, modeling linear and nonlinear relationships with better generalization and effectively handling large datasets and high-dimensional datasets [117].However, SVM-based methods are computationally complex and require significant time and memory when the number of support vectors becomes large.Decisiontree-based indoor localization has shown good performance in improving localization accuracy [118].The disadvantage of decision trees is the possibility of missing information when processing and classifying continuous numerical data.

Filter-Based Approaches
Filter-based methods are usually applied to fuse data from multiple sensors to provide high accuracy for indoor solutions.The localization system state is often not directly available, and the localization system state is usually estimated from a system measurement model and a motion model.Mathematically, these two models can be represented as follows: where k is the timestamp, x k is the system state for time k, f (x k , w k ) is the state-dependent equation of motion, h(x k , v k ) is the state-dependent equation of measurement, y k is the measurement (i.e., magnetic field), and w k and v k represent process noise and measurement noise, respectively.Hidden Markov Model: A Hidden Markov Model (HMM) is a statistical Markov model in which the system x (hidden state) is assumed to be a Markov process.The HMM assumes the existence of another process y that depends on x and can be learned by observing y.As shown in Figure 10, a typical Hidden Markov Model is described by a state-space model.Formally, the HMM model is characterized by five parameters: • B ∈ R N×M is the emission probability matrix, where B ij indicates the emission probability at time j from state x i , • π ∈ R N×1 is the initial state distribution.If there is no prior knowledge about the initial state of smartphone, the vector π = 1 N , . . ., 1 N , HMM addresses three main types of problems: Evaluation problem: Knowing the model parameters λ = (A, B, π), and the observed sequence Y = {y 1 , y 2 , . . . ,y M } ∈ R M×1 , calculate the probability of occurrence of the observed sequence.
Prediction problem (also called the decoding problem): The model's parameters λ = (A, B, π) are known, and the sequence of observations Y = {y 1 , y 2 , . . . ,y M } ∈ R M×1 and the most likely states sequence corresponding to the observations sequence is calculated.
In magnetic field positioning, we use the k-th hidden state x k of the HMM to denote the user's position after step k.There is a special conditional probability distribution for geomagnetic field intensity observations called the emission probability distribution.A complete HMM consists of the initial probability, the transition probabilities, and the emission probabilities.Usually, the initial probability P(x 0 ) is known.The transition probability P(x k | x k−1 ) is calculated by pedestrian dead reckoning (PDR).The emission probability P(y k | x k ) is the probability of observing the geomagnetic intensity y k in state x k .The HMM then generates observations at each state through the emission probabilities.Ma et al. [119] proposed Basmag, a HMM-based indoor localization system using a Backward Sequence Matching Algorithm (BSMA) to optimize the HMM and improve the low discriminability of the geomagnetic signal with the help of PDR.Kwak et al. [120] presented an unsupervised learning algorithm based on HMM and designed a lightweight algorithm to compare the similarity of magnetic fingerprints.It is reported that the matching learning accuracy is 96.47%, and the positioning median error is 0.25 m.The Kalman filter or extended Kalman filter applies to Gaussian distributions and cannot be applied to non-Gaussian signals.HMM is more computationally efficient than particle filters of high complexity.Compared to other Bayesian filtering techniques, HMM is more suitable for representing the complex motion of indoor targets [121,122].

Evolution of states Emission probabilities
Observables Time Transitional probabilities Kalman filter: Kalman filter principle is well described in [123][124][125].Assume that f is a linear function with respect to x k and w k and h is a linear function with respect to x k and v k , then Equation (33) can be rewritten as: where w k ∼ N (0, Q k ) and v k ∼ N (0, R k ) are zero-mean white Gaussian noise and independent of each other.The covariances of w k and v k are, respectively, Q k and R k .The process and measurement matrices A k and H k , and the noise parameters Q k , R k are time variables.The covariance matrix P is updated between measurement steps: x k ∼ N (µ k , P k ), where µ k and P k are the mean and covariance matrix of x k , respectively, the correction equation for the measurement update is: The Kalman gain matrix K k is calculated for each update: Zhao and Wang [126] showed that the use of EKF could reduce the cumulative error of inertial sensors and improve the accuracy of orientation and position measurements.Wang et al. [127] fused information obtained from the PDR and the magnetic fingerprint with EKF and PF schemes.It demonstrated higher localization performance than using PF alone.
In a positioning system, the system state or user state is the user's position and orientation.
x = (p x , p y , θ) (44) Assuming that the user's motion is considered to be on a horizontal plane (2D), we can obtain the acceleration and orientation from the accelerometer and gyroscope in the smartphone.The relationship between these sensor measurements and the user's state is as follows, and Equation ( 38) can be rewritten as: where l is the step size, ∆θ is the user's change in heading between two consecutive steps, and G l ∼ N(0, σ l ) and G θ ∼ N(0, σ θ ) are Gaussian noise.
In the measurement model, we use the magnetic fingerprint as the primary observation y.Equation ( 39) is used to obtain the observations for state x in the fingerprint database.
The initial values of the system state x 0 and the covariance matrix P 0 are set, and the parameters of the process noise Q 0 and the measurement noise R 0 are obtained from the sensor measurements.A Kalman-filter-based positioning system is complete.
Particle filter: A particle filter is a Sequential Importance Sampling (SIS) method that expresses the state distribution of an object by extracting random state particles from the posterior probabilities.Each particle x k has a corresponding weight W k that represents the value of the function at the point determined by that particle.The greater the number of particles, the more approximate the desired distribution function.
In particle filters, the state of the object of interest is usually represented by the vector x.We may be interested in the user's position and velocity during localization.Therefore, we can represent each state by a vector containing the (p x , p y ) position and user velocity.The prior probability function represents a roughly calculated value of the following possible state, given that we have information about its current state (dynamics).After the observation, the weights of the particles are updated to form the posterior probability function P(x k+1 | y k+1 ), which represents the probability of updating the particle x k+1 when y k+1 is observed.
To estimate the next state, we only need to resample the weighted particles, preserving the size of the particle set.In the prediction step, the weights of each new particle are adjusted according to the motion dynamics model with random errors.The function represented by the new set of particles is then considered as the new prior function P(x k+1 | y k ) for the next step [128,129].
Figure 11 illustrates a particle filter loop.Layer 1: In the first layer, we have n particles represented by circles of different sizes, indicating the importance of a particle W k ∈ R 1×n .
Layer 2: The second layer illustrates the resampling process, where are resampled according to their weights, and particles with higher weights have a higher chance of being selected.The same particle can be selected multiple times-resampling.When a single sample has extremely dominant weights, the resampling step is necessary for degeneracy.After the particles are resampled, the weight distribution is set to be uniform.
Layer 3: The motion process of the particles shown in the third layer is predicted to be different since each particle has a different state after applying the model A k .
Layer 4: Noise w k is applied to cover some unlikely assumptions and distinguish the particles if some of them are the same-the resampling step.
Layer 5: After obtaining the noise measurements, the observation model is evaluated based on the state estimates of each particle.The observation model assumes the probability that the measurement y k will occur when we know the state x k of the object.Layer 6: The sixth layer shows the posterior probability function resulting from the measurement step.Applying the observation model to each particle, particles whose observations are similar to actual ones will have greater weights.In contrast, particles distant from the actual observations will receive low weights.Finally, the updated particles are used to evaluate the state (e.g., median or mean of the particle states) for the next iteration.
We now describe how the particle filter actually works.First, N random particles are generated from an initial region γ = {ξ 1 , ξ 2 , . . . ,ξ N } ∈ R n×1 .A particle is an assumption about the state of the user with a weight.
where w i is the weight of the particle.The motion model P(x k+1 | y k ) for each particle is updated with Equation (46).The probability of observing y on state x is given as where n is the dimension of y, V is the covariance matrix, and g(x) is a function to obtain observations of state x in the fingerprint database.We evaluate each particle by Finally, we use the weighted average of the current particles to estimate the true state, as shown in Equation (50).
The particle filtering approach has specific applications in magnetic field localization.For example, Xie et al. [130] innovated the motion, measurement, and resampling models for smartphone indoor localization systems and proposed a reliability-augmented particle filter.They used a dynamic step estimation algorithm and a heuristic particle resampling algorithm to reduce the error of motion estimation and improve the robustness of the elementary particle filter.The use of combined PF and EKF is proposed in [127] to fuse the information obtained from PDR and magnetic fingerprinting and to improve the inherent blindness in the traditional PF scheme and solve the particle degradation problem.This fusion algorithm has a localization accuracy of 1-2 m in large buildings when the user walks slowly, which has a higher accuracy compared to many other algorithms.

Simultaneous Localization and Mapping
Simultaneous localization and mapping (SLAM) uses both mapping and localization algorithms to build a map and simultaneously localize objects within that map.Many researchers have recently combined SLAM with smartphone sensor data for location estimation, as summarized in Table 5. Wang et al. [131] introduced eSLAM, a simultaneous localization and mapping (SLAM) method that utilizes measurements of the ambient magnetic field present in all indoor environments.They implemented a modified exponentially weighted particle filter to estimate objects' pose distribution and a Kriging interpolation method to update the magnetic field map.Through simulations on Matlab and tests on mobile devices, they observed two interesting phenomena: the shift in position estimation after sharp turns and the cumulative error.
Besides this, there are two main challenges for SLAM based on magnetic field measurement.The first one is that map construction for large-scale indoor environments is a difficult task.The second one is that the continuous data exchange between the map and the localization algorithm consumes a lot of power.Vallivaara et al. in [82] proposed a SLAM method using the local anomalies of the ambient magnetic field.A Rao-Blackwell particle filter was implemented for the pose distribution estimation of the robot, and Gaussian process regression was used for magnetic field map modeling.MagSLAM was presented in [132], and it demonstrated that simultaneous localization and mapping of indoor pedestrians using measurements of ambient magnetic field strength and human stride measurements without using an a priori map built by ground truth-based methods could be scalable and accurate.The work in [86] combines reduced-rank Gaussian process regression and Rao-Blackwellized particle filter to provide a scalable 3D magnetic field SLAM algorithm.It shows the feasibility of using smartphone measurements to obtain accurate position and orientation estimates.SemanticSLAM [90] is a calibration-free indoor positioning system that utilizes unique signatures of specific locations in an indoor environment.Unique signatures include unique patterns in the smartphone's accelerometer when climbing stairs, unusual magnetic interference in specific locations, as well as unique Wi-Fi access on others locations.SemanticSLAM used these unique signatures as landmarks and combined them with a pedestrian dead reckoning in the (SLAM) framework to reduce localization errors and convergence times.It shows a median positioning error of 0.53 m with fast convergence times.

Neural Networks MF-Based Methods
There have been many studies on magnetic field localization methods based on an artificial neural network (ANN), and ANN is often applied for classification and prediction.For magnetic-field-based localization, the NN is trained using the magnetic field measurements and the corresponding position coordinates obtained in the offline phase.Once the ANN is trained, it can estimate its location based on the online magnetic field measurements.The existing ANN-based methods for magnetic-field-based localization are mainly a convolutional neural network (CNN) and a recurrent neural network (RNN).CNN usually converts magnetic field fingerprints into 'image patterns' for classification and RNN for magnetic field time sequence prediction.Table 6 summarizes the deep-learning-based approach to magnetic field localization.
DeepPositioning is a deep-learning-based indoor fingerprinting solution that combines magnetic field and WiFi fingerprinting with a deep neural network model to improve the accuracy of indoor localization [133].While DeepPositioning is computationally expensive in the training phase, it is lightweight in the testing phase, which is advantageous for achieving real-time indoor localization on mobile devices.The performance of DeepPositioning depends on the number of APs (access points), RPs (reference points), and labeled samples in the training dataset.
Ashraf et al. [134] presented a multi-sensor indoor localization method using magnetic field measurements from a smartphone magnetometer and images from a camera to construct a database.A deep-learning-based convolutional neural network (CNN) classifier was used for scene recognition to narrow the search space of the database.Considering the similarity of magnetic signatures and the spatial proximity of the selected candidates, a modified K-nearest neighbor (mKNN) was proposed to compute the current location of pedestrians to improve the accuracy of localization.An extended Kalman filter was also implemented to further optimize the location estimation from the pedestrian dead reckoning data.This method is reported to be able to locate a person within 1.08 m 50% of the time for any smartphone used for localization.This represents a solution to the magnetic field localization method for heterogeneous smartphones.
MINLOC [135] proposed using a Magnetic Pattern (MP) and CNN for indoor localization.The MP generated at the measurement point is used to construct a database.The trained CNN is used to calculate the location.A voting mechanism is designed to vote on the predictions of multiple CNNs to estimate the user's current location indoors.The method does not require knowledge of the user's starting location and investigates the effect of various user heights on the localization performance.The results show that the localization accuracy of MINLOC is within 1.01 m 75% of the time, taking into account the heterogeneous smartphone and user height.This method performs better than the other two methods, mPILOT [19] and GUIDE [20].
Sun et al. [136] proposed a hybrid localization method based on Bluetooth RSS (received signal strength) and magnetic field measurement data.The method converts the Bluetooth signal strength data in the fingerprint library into a 'fingerprint image' and then uses CNN for fingerprint localization.First, the CNN is used to classify the floor by the received Bluetooth signal strength, and the classification accuracy of floor location reaches 96.7%.After the floor was classified, the real-time magnetic field measurement data were matched with the magnetic field data in the area database to calculate the coordinates of the unknown point.The test accuracy reached 93.33%, with a positioning error of fewer than 1.4 m.When using a CNN for the dynamic localization test, the classification accuracy exceeds 91%, and the accuracy of dynamic localization is also within 1.55 m.This convolutional-neural-network-based fingerprint localization method provides a new solution for multi-floor large indoor environments.
DeepML is a system based on deep long and short-term memory (LSTM) [137].It uses the magnetic and light sensors of a smartphone for indoor localization.Bimodal images were built by preprocessing, and location features are extracted by a trained deep LSTM network.Finally, an improved probabilistic approach is leveraged to estimate the smartphone's location.The experimental results showed that about 58% of the test locations had a position error of less than 0.5 m, and 82% had a position error of less than or equal to 2 m in the laboratory.In the corridor, 65% of the test locations had a position estimation error less than or equal to 0.4 m.A total of 87% of the test locations achieved an error of 3 m or less.
RNN was introduced to predict the position of geomagnetic signal sequences generated when objects move [138][139][140][141].A recurrent neural network (RNN) is a deep neural network model identifying time-varying data sequences.RNN combines current input data with remembered previous data sequences to produce output results from its recurrent network model.According to the test results, the geomagnetic field signal localization based on the LSTM model has a localization accuracy of 0.51 m in a medium-scale testbed and 1.04 m in a large-scale testbed.The average localization errors of the basic RNN model were 1.20 m and 4.10 m, respectively, [138].
The work in [141] mentioned that despite having the same magnetic field measurements at multiple locations, the spatial/temporal sequence of magnetic field values around a particular region would form a unique pattern over time.Therefore, an LSTM deep recurrent neural network (DRNN) is proposed for learning magnetic patterns from spatial/temporal sequences.The experimental results show that the overall classification accuracy of the DRNN model is 97.20%, which is better than traditional machine learning methods, such as support vector machines and K-nearest neighbors.
Neural networks are promising in complex environmental scenarios where feature extraction is high and there is challenging data dimensionality [142].Neural networks allow for analyzing large amounts of unlabeled and unclassified data.Its most significant advantage is automatically extracting features from the acquired data without manual extraction [143].Indoor positioning is often faced with global positioning errors and kidnapping robot problems.When the initial position is unknown, this is known as the global localization problem.An RNN estimates the next position by predicting a time series and can be an excellent solution to this challenge.

Smartphone-Based Pedestrian Dead Reckoning
Inertial navigation is an infrastructure-free method that uses inertial sensor measurements (accelerometers and gyroscopes) on the pedestrian to track the position and orientation of the object relative to a known starting point [144,145].
Inertial navigation technologies are divided into strapdown inertial navigation system (SINS) and pedestrian dead reckoning (PDR).
SINS binds one or more Inertial Measurement Units (IMUs) on the human body (such as head, waist, legs, feet, etc.), utilizes the mechanical equation to calculate the location of pedestrian, and employs Zero Velocity Update (ZUPT) to reset the integration errors [87].PDR calculates walking steps and estimates step length and moving direction based on the smartphone-embedded IMUs to reckon the position of pedestrian.The challenge with PDR-based methods is the accurate heading estimation for the user, which is especially difficult when the user is carrying the device in any position.Moreover, both PDR and SINS approaches suffer from the drift problem (i.e., small errors in the measurement of acceleration and angular velocity which are integrated into progressively larger errors in trajectory estimation), which makes it unsuitable for long-term localization.
The fusion of PDR/SINS and magnetic fingerprint localization can mitigate this problem and achieve better localization accuracy than a single magnetic fingerprinting localization method.

Step Detection
Recent literature has proposed using the camera [146] and gyroscope data [147] for step counting, and we focus here on step counting with a built-in accelerometer for smartphones.Time domain approaches: Time-domain methods can be divided into thresholding [148], peak detection [149], zero-crossing [150], and auto-correlation [151][152][153].
1. Threshold: The threshold method calculates the number of steps by determining whether the sensor data meet some predetermined threshold.The work in [154,155] proposed a relative threshold detection scheme.It uses acceleration measurements already projected into the vertical direction to detect steps.The scheme detects a step when a valid maximum peak (as a maximum value) and a valid minimum peak (as a minimum value) are detected in sequence over a specific time interval.The maximum value is the most prominent peak above the upper threshold, while the minimum is the minor peak below the lower threshold.The upper threshold is determined by the sum of the last valid minimum and the ∆ threshold value, while the lower threshold is determined by subtracting the last valid maximum and the ∆ threshold value.2. Peak Detection: The heel causes sharp changes in vertical acceleration when it touches the ground, and we can use these acceleration maxima for step counting.Typically, the impact of the foot on the ground may cause multiple local peaks due to the large forces generated by the motion of the sensor [149].Yang and Huang [150] proposed a new peak detection algorithm for smartphones carried in an unconstrained manner.First, a rotation matrix is obtained using a Kalman-filter-based pose estimation algorithm.Then, the acceleration measurements are converted from the device reference frame to the earth reference frame.Finally, the peak algorithm is used to detect and calculate the number of steps for the vertical component of the acceleration in the earth reference frame.3. Zero-crossing: The steps are detected by analyzing the magnitude of the acceleration signal and subtracting the local gravity coming from the magnitude of the acceleration measurement.A repetitive pattern can be observed when the user starts walking.The acceleration signal crosses the zero mark once in the negative direction and then in the positive direction.This phenomenon is called zero-crossing, and a new step is calculated when the acceleration signal changes from negative to positive [88].Seo et al. [156] used an advanced scheme to detect the zero-crossing and then employed linear regression to estimate the number of steps using zero crossings.4. Auto-correlation: User walking is repetitive, and the periodicity of walking leads to a strong periodicity of sensor data [157].Auto-correlation can be used to compare the correlation coefficients between two adjacent windows of accelerometer data.If the user is walking, then the auto-correlation will spike at the correct period of the walker.The work in [152] presents Normalized Auto-correlation-based Step Counting (NASC).When a person is walking, the normalized auto-correlation will be close to 1 when the time lag τ is exactly equal to the period of the acceleration pattern.Since the value of τ is unknown beforehand, NASC tries to find τ = τ opt between τ min and τ max such that the value of the normalized auto-correlation is maximized.
Pan and Lin proposed a step counting algorithm for smartphone users [151].Firstly, the linear acceleration and gravity values are collected from the smartphone's accelerometer to obtain the horizontal component of the linear acceleration value.The starting point of the possible periodic linear acceleration measurement is determined.Finally, the raw data collected from the data collection phase are segmented using the correlation coefficient method to find the potential correlation segments as the number of steps taken by the user.Brajdic and Harle [158] surveyed various standard step counting algorithms in the literature and compared them fairly and quantitatively using different smartphones.They came to two important conclusions.Firstly, a straightforward thresholding of accelerometer standard deviations can robustly and inexpensively detect walking times.Second, the windowed peak detection algorithm is overall the best choice for step counting, regardless of the smartphone placement.Santos et al. [153] first determined the peak frequency by subtracting its average value from the acceleration signal and using Fast Fourier transform.A band-pass filter is then used to remove high frequencies and frequencies below 1 Hz.Afterward, the moving standard deviation of the acceleration magnitude is used as a dynamic threshold to detect whether the user is stopping or moving, dividing the acceleration signal into different segments.Finally, an auto-correlation function is implemented for each segment to detect the steps performed by the user and obtain the number of calculated steps.
Frequency domain approaches: A windowed subset of the periodic accelerometer signal is transformed into the frequency domain, and the principal frequency can be used as the walking frequency.Barralon et al. [159] analyzed the accelerometer data to detect the walking phase using the short-term Fourier transform (STFT) [160] or continuous/discrete wavelet transform (CWT/DWT) [161,162].It was reported that the method using DWT decomposition was the most effective.FFT cannot determine when each frequency component occurs and introduces resolution problems.CWT/DWT can capture sudden changes in acceleration but is more computationally expensive [163].Lester et al. [164] developed an adaptive FFT energy-based filter that selects the lowest frequency band that accounts for 10% of the energy in the FFT output to calculate the pace.This energy threshold is shown to be robust under various conditions.Brajdic and Harle [158] used the STFT to calculate the number of steps per window.The window width is divided by the dominant walking period it detects, and these fractional values are summed to estimate the number of steps taken.Brajdic and Harle [158] zeroed all CWT/DWT coefficients outside the walking frequency band, followed by inverting the conversion to remove the DC component and retaining the walk information.Individual steps are then extracted according to the Mean Crossings Counts algorithm.After preprocessing the data from the accelerometer and applying the fast Fourier transform, the results showed a walk success rate of 87.52% [165].
Feature clustering approaches: Other research works proposed the use of Hidden Markov Models (HMMs) [166][167][168], together with K-Means clustering [169,170] and other machine learning algorithms, to classify activities by time and frequency domain features extracted from accelerometer signals [171,172].In [158], Brajdic and Harle dynamically train the HMM in a rolling time window to distinguish between gait states (e.g., heel-off, toe-off, heel strike, and foot stationary).The model periodically assigns one state to the hill and the other to the valley of the stride.Brajdic and Harle also tested the K-Means Clustering method.The Lloyd algorithm [173] was used to partition the feature vector of the rolling time window into two clusters (hills/valleys).They predicted the results by computing the closest cluster.

Step Length Estimation
Due to the drift error of smartphone accelerometers, the double integration of acceleration method is not suitable for step-length-based pedestrian dead reckoning (PDR) [144].Researchers proposed several step estimation models to calculate the step length.Techniques for estimating step length usually use parameters such as acceleration, step frequency, or height as input [174].They often estimate gain using artificial neural networks [175], Kalman filter, and its variations [176,177], as well as a particle filter [178,179].
Alternative, ad hoc but simpler methods exist.Weinberg proposed Equation ( 51) to determine the step length with vertical acceleration [180].
where A max and A min are the maximum and minimum values for a single step in vertical acceleration, respectively, and K 1 represents the constant to obtain the proper step length.Ho et al. proposed an adaptive estimator based on the average step speed model to obtain the walking step length [181].They trained K 2 with the linear regression model shown in Equation ( 52) where vstep X , vstep Y , and vstep Z are the magnitudes of the average velocities on the X, Y, and Z axes in each step, respectively.K 2 was then brought into Equation (51).The work in [182] modified the Weinberg formula by including another tunable constant.
Zhou et al. [183] extended Equation (51) as follows: A deep learning network StepNet was presented in [184] to estimate the Weinberg gain K 1 .The average error of the StepNet architecture with regression steps is 3.2% when only using accelerometer measurements.Kim et al. proposed Equation (56) to determine the step length with average vertical acceleration of the current step [185].
where A k is the acceleration measurement at the k-th sample in the current step, N is the total number of samples per step, and K 5 is also a constant for step length estimation.The work in [186] extended this model to improve the accuracy of step size estimation.
Tian et al. developed a lightweight step-based tracking algorithm and proposed the novel step estimation model [144] shown in Equation (58).
where f s is the measured step frequency, h is the height of the smartphone user, and K 8 is a constant equal to 0.3139 for males and 0.2975 for females.Zijlstra and Hof [187] presented a model based on the vertical displacement of the center of body mass (CoM): where h is equal to the change in height of the CoM, and l equals the pendulum length.The location of the smartphone influences the performance of the acceleration model based on the gait model.The walking speed affects the performance of the model that includes the step frequency.By adjusting the gain parameters of the gait model, the accuracy of the step estimation as well as the localization performance can be improved.

Step Direction Estimation
Sensor fusion schemes and signal processing methods are continuously proposed to obtain accurate walking directions.Smartphone orientation estimation typically uses embedded accelerometers, gyroscopes, and magnetometers.Ideally, accurate direction estimation can be obtained from gyroscope data, but the Gaussian white noise in the gyroscope readings generates cumulative errors (cumulative errors are also known as drift) [188,189].Therefore, accelerometers and magnetometers are used to compensate for the drift to obtain more accurate attitude estimates [190].Commonly used fusion techniques include Kalman filtering, extended Kalman filters [190][191][192][193], unscented Kalman filters (UKF) [194], adaptive Kalman filters (AKF) [195,196], particle filters [197], complementary filtering [198], Madgwick AHRS [199], etc. Kim et al. [198] proposed StrokeTrack, an efficient complementary filter to reduce gyroscope drift with lower complexity compared to the Kalman filter.The complementary filter implements a combination of a low-pass filter for accelerometer and magnetometer data and a high-pass filter for gyroscope data [200].Yean et al. [190] proposed two fusion algorithms: complementary filtered feedback (CFF) and gradient descent with quaternion-based Kalman filtering (KFGD).CFF shows its potential to correct for drift by setting trust weights that favor accelerometer and magnetometer data over gyroscope data.KFGD has the best performance.With the smartphone sensor data, KFGD ensures a consistent output, while Madgwick [199] is sensitive to changes in orientation.The results show that KFGD outperformed Madgwick.
Fourati et al. [201] used a complementary nonlinear filter coupled with the Levenberg Marquardt Algorithm (LMA) to process IMU measurements.
Kok and Schön [202] improved the Madgwick AHRS [199] method using directional deviations parameterized by the rotation vector to estimate directions, reducing the computational complexity by about 1/3 and allowing for more accurate estimates when largescale updates are made to the estimates.The multiplicative EKF (MEKF) mentioned in work [203,204] is an alternative technique that sets the directional deviation with the rotation vector (axis angle) as a parameter.
Renaudin and Combettes [205] presented a new attitude and heading estimation filter based on Magnetic, Acceleration fields, and GYroscope Quaternion (MAGYQ), which uses quaternions to represent state vectors and angular rate measurements and applies an extended Kalman filter (EKF).In the update step, the magnetic field angular rate (MARU) and the observation equation using the acceleration gradient update (AGU) are used.MAGYQ can often be used to constrain gyroscope errors even in indoor spaces where the Earth's magnetic field is disturbed.
uDirect [206] is a method of determining the orientation of a user using a mobile phone, regardless of the orientation of the phone.uDirect can calibrate measurements of a mobile phone in any orientation and estimate the orientation based on the acceleration pattern of a person walking.When the mobile device is placed in the user's trouser pocket, the horizontal sample in the middle of the standing phase is the most informative sample of the user's forward direction.

Hybrid Localization
Different localization techniques have various advantages and limitations in terms of accuracy, coverage, requirement for infrastructure, and cost of deployment, and no single localization method can meet the demands of all applications [92].The localization service performs better with a multimodal approach compared to monomodal approaches [207].It is essential to fuse different localization signals and enrich the database to improve the localization accuracy [208].The PDR-based magnetic field fingerprint localization algorithm is a hybrid localization method that integrates IMUs.
The fusion of magnetic fingerprinting and WiFi complements their location resolution capabilities.WiFi is a short-range radio.It ensures that distant locations will see a different radio environment (with less or no common APs), while nearby areas will share a similar radio environment.In contrast, geomagnetic strength is global.A distant location may have a similar magnetic field, while a nearby location may have a different magnetic field due to interference from the local magnetic field.Magicol [31] combined magnetic fields with WiFi to improve the localization accuracy through a particle filter.DeepPositioning [133] combines WiFi's Received Signal Strength Indicator (RSSI) and the prevalent magnetic field to obtain a richer fingerprint using a deep learning approach for indoor positioning.Ban et al. [209] combined pedestrian death projection (PDR), WiFi, and residual magnetism.Fingerprints are represented by Gaussian Mixture Models (GMMs) to reduce computational effort.All these methods are proven to be more accurate in detecting locations.
As magnetic anomalies can only affect a limited area, many of the magnetic signals received from areas far from the disturbance may be the same, which can degrade positioning accuracy.Du et al. [210] proposed a camera-assisted area-based indoor localization system for magnetic fields that maximizes the benefits of local magnetic field anomalies.The camera-assisted magnetic field solution improves more than 50% of the average error distance in both less and more disturbed environments compared to using magnetic fields alone.Rajagopal et al. [211] showed how Visual Inertial Odometry (VIO) and beacon could be combined to construct a dense indoor magnetic field map that serves as a fine calibration of the compass to determine the orientation of a mobile device quickly.The approach enables multi-user (and even cross-platform) AR applications where users can orient themselves based on a standard global reference (magnetic field) without sharing any visual feature maps.Huang et al. [116] constructed a fingerprinting database with Channel State Information (CSI) and magnetic field information.They then implemented an improved Line of Sight (LOS) recognition algorithm to narrow the matching area and provided a Multi-Dimensional Scaling k-Nearest Neighbor (MDS-KNN) method to achieve fingerprint matching.The algorithm provides better robustness and higher localization accuracy than traditional fingerprint localization methods.

Comparison, Applications, Challenges and Prospects
In this section, we compare magnetic-field-based methods with alternative methods based on Wi-Fi, Bluetooth, GSM, and FM and discuss applications, such as geomagneticbased smartphone positioning in practical scenarios.

Comparison of Different Indoor Positioning Techniques
Compared to radio signals based on Wi-Fi, Bluetooth, GSM, FM, etc., magnetic-fieldbased positioning does not require infrastructure and saves deployment costs.While radio signals change over time, magnetic field data have the advantage of long-term stability.Radio signals, such as Wi-Fi, are shadowed, absorbed, and affected by multipath propagation, while the ubiquitous Earth's magnetic field is almost unaffected by human activity [17].
Table 7 compares the latest indoor positioning technologies based on Wi-Fi, Bluetooth, GSM, camera, FM, acoustic, inertial sensors, and magnetic field.
Zhang et al. [212] proposed a fused indoor localization algorithm for smartphones based on long-and short-term memory (LSTM) networks, which integrates wireless latency (Wi-Fi) features and PDR features.The fused indoor localization can be formulated as a recursive function approximation problem where a sliding window-based displacement scheme is designed to generate a time series-based feature dataset.Data fusion and localization are accomplished by exploiting the advantages of LSTM networks for time series prediction and characterization.The proposed fusion localization has an average error of about 0.4 m at best-a 90% reduction in localization error compared to filterbased localization.
Chen et al. [213] proposed a feasible fusion framework using particle filters to fuse datadriven inertial navigation with Bluetooth Low Energy (BLE)-based localization.Typical BLE-based positioning technology can achieve a mean positional error (MPE) of 1.76 m.The fusion algorithm tested four smartphone uses: texting, swinging, calling, and pocketing.The mean positional error reached 0.78 m, 1.63 m, 1.11 m, and 0.96 m, respectively.
Rizk et al. [214] present CellinDeep, a deep-learning-based localization system.It uses a deep network to model the inherent dependencies between different cell towers in an area of interest, capturing the nonlinear relationship between the cellular signal heard by a smartphone and its location.CellinDeep's test results on different Android phones show that it can achieve a median localization accuracy of 0.78 m.
The inertial sensor-based PDR algorithm proposed by Poulose et al. [215] uses the complementary features of magnetometers and gyroscopes to address the cumulative errors present in PDR localization.First, pitch and roll values are estimated based on accelerometer and gyroscope measurement fusion.The estimated pitch values are used for step detection.The authors estimate the step length from the pitch amplitude and the pedestrian heading from the fusion of magnetometer and gyroscope sensor values.Finally, the position is estimated from the step length and direction information.The proposed pitch-based step detection algorithm achieves an error of 2.5% compared to the acceleration-based step detection method.The heading estimation proposed in this paper achieves an average heading error of 4.72 • compared to azimuth and magnetometer-based methods.The authors tested the proposed position estimation algorithm through three indoor experiments, which showed high position accuracy.In the rectangular motion experiment, the proposed algorithm showed a maximum error of 2.6 m.In the linear motion experiment, the proposed algorithm showed a maximum error of 0.94 m.In the circular motion experiment, the proposed algorithm shows a maximum error of 1.2 m.
Du et al. [216] proposed a fingerprint localization algorithm (KF-KNN) based on FM signals.Firstly, FM data acquisition equipment establishes the RSSI fingerprint database of the area of interest.Secondly, the KNN technique is used to complete the rough location calculation; finally, the Kalman filter model predicts and optimizes the rough location information.The result shows that the average localization error of the KF-KNN algorithm can be as low as 1.9 m.
Poulose and Han [217] proposed a hybrid system that combines camera-based and IMU sensor-based approaches for indoor localization.The experimental results show that the proposed simultaneous localization and mapping (UcoSLAM) fusing keypoints and square plane markers with the hybrid system based on IMU sensors have an average localization error of 0.0690 m.
Chen et al. [218] present a system using acoustic ranging signals, which can be used in almost all commercial off-the-shelf (COTS) smartphones.A two-stage algorithm based on a generalized cross-correlation (GCC) approach and time-frequency-based feature extraction is designed to detect the modulated signal transmitted by each specially designed anchor station consisting of a loudspeaker.The detected timestamps are converted into time differences of arrival (TDOAs) observations, which can be applied together with the leastsquares (LS) estimator to obtain the smartphone in the static case position.In addition, an extended Kalman filter (EKF) is used to fuse range observations from the inertial measurement unit (IMU) and acoustic TDOA ranging observations to estimate a better trajectory in the dynamic case.The experimental results show that the average error in range estimation is about 0.3-1 m.Four anchor points in the first scenario achieved dynamic positioning accuracies of 0.5 m at 50% and 1.6 m at 95%.In the second scenario with a large test site, dynamic positioning accuracies of 0.5 m at 50% and 1.82 m at 95% were achieved with eight anchors.
Zhang et al. [219] proposed an indoor magnetic localization algorithm for smartphones based on LSTMs that exploits the potential predictive power of LSTMs to solve the indoor magnetic localization problem, thus avoiding the time-consuming fingerprint matching localization.A double sliding window-based dimension expansion scheme was applied to preprocess magnetic data to overcome the low discernibility problem of magnetic signals.The proposed magnetic localization has a best average error of 0.53 m-a 58% reduction in localization error compared to DTW localization.
As can be seen in Table 7, Wi-Fi, camera, GSM, and acoustics consume more energy.Cameras, acoustics, inertial sensors, and magnetic fields do not require infrastructure and are less costly.The experimental results show that the accuracy of magnetic field localization is at a medium level.The low deployment cost, low energy consumption, and medium accuracy of the magnetic field make it a practical method to explore.We have reviewed the most recent commercial companies offering indoor positioning software in Google Play and the App Store to see the current trends in indoor positioning technology based on their solutions.The existing commercial indoor positioning companies are listed in Table 8.These companies provide a public API (application programming interface) for Wi-Fi, BLE, inertial sensors, and magnetometer positioning that third-party developers can use.As of early 2022, there are still more commercial companies using Wi-Fi and iBeacon than those using geomagnetism, suggesting that existing Wi-Fi and Bluetooth fingerprints can still provide more reliable location services despite the drawbacks in terms of energy consumption and fingerprint stability.The application of academic research in magnetic positioning to real products remains very challenging.While Oriient only uses magnetic positioning, Indoor Atlas and Gipstech fuse magnetic signals with inertial sensors, Wi-Fi, and Bluetooth to provide more accurate positioning.Magnetic-field-based indoor positioning can be used to complement hybrid indoor positioning systems to provide better indoor positioning services.

Challenges for Magnetic Field Based Localization
Due to smartphones' limited battery and computing power, smartphone-based positioning technologies need to balance accuracy, complexity, and performance in terms of latency.The main challenges for magnetic-field-based indoor positioning applications are as follows: 1. Positioning accuracy: Magnetic field measurements have only three elements with low discernity, which may be duplicated at several locations in a large indoor environment.2. Constructing magnetic map: The construction of a reliable magnetic field map is timeconsuming and labor-intensive and requires advanced equipment calibration.Suppose a crowdsourcing approach is used to build the map.In that case, it is not easy to merge multiple databases into one, and the heterogeneity of the equipment needs to be taken into account.3. Environmental noise: The installation of items containing ferromagnetic materials such as washing machines, vending machines, and lifts can affect the MF measurements of the smartphone.It requires updating and maintaining the magnetic fingerprint database [17].4. Complex user behavior: Smartphone-based indoor positioning is complex.For example, positioning accuracy can be affected by differences in smartphone users (male and female, height, handheld position) and user behavior (calling, texting, pocketing).Using accelerometer and gyroscope data to track the behavior of the smartphone user and obtaining a rotation matrix to transform the magnetic field data from the device frame to the Earth frame introduces accumulative accelerometer and gyroscope errors and deviation.5. Energy efficiency: When choosing a localization algorithm, the complexity of the localization solution needs to be considered.Algorithms with higher complexity will consume more energy while taking longer to compute, and delays in localization can disrupt the user's experience [10,231].6. Reproducibility and generality: There is no single standard for evaluating the positioning accuracy of different algorithms.Most experiments in the literature are walking experiments in a small area of an office building.In a constrained environment, authors use a homogeneous smartphone and the same carry position during the training and localization phase to achieve an accuracy of less than 1 m.However, practical application scenarios are often more complex than experiments, and heterogeneous smartphones and different carrying patterns can decrease accuracy.Its reproducibility and generality are low in practical deployment [88].
10.4.Future Prospects for the Use of Magnetic Fingerprint-Based Technology We take a closer look at promising applications that could use magnetic-field-based positioning techniques and options that could further enhance magnetic-field-based positioning.
1. Applying cross-domain techniques: Cross-domain techniques such as signal processing, machine learning, and deep learning techniques can be implemented to optimize existing magnetic field fingerprint-based localization.Magnetic field localization schemes can also benefit from using deep learning techniques such as RNN for faster and more accurate position estimation [231].2. Hybrid Indoor Positioning Approaches: Depending on the required positioning accuracy, the combination of magnetic fields with Wi-Fi, Bluetooth, and GSM complements the hybrid positioning solution.3. Providing location-based services: Use magnetic positioning to determine the location of a target of interest and then use location-based services to obtain information about that target, such as 'restaurant prices and customer reviews' or 'seller promotions'.4. Seamless indoor-outdoor positioning system using magnetic fingerprinting: The unified use of magnetic field positioning technology for indoor and outdoor positioning allows seamless user tracking, making it a universal positioning solution.

Conclusions
A review of indoor localization techniques using magnetic technologies has been presented.This review aims to provide a comprehensive awareness of magnetic fingerprintingbased localization techniques used in indoor environments.We first provided a detailed description of the magnetic field characteristics and discussed its advantages as well as its challenges.We then described the magnetometer model and the effect of ferromagnetic interference.Several coordinate systems commonly used for magnetic field localization were presented, and their transformation relationships were described.Existing magnetic field benchmark databases were described in detail, and researchers can select suitable datasets to test their algorithms.We also summarized magnetic field calibration algorithms and analyzed their accuracy, robustness, computational cost, and deployment.Traditional surveyor construction of magnetic field maps is labor-intensive, and we reviewed crowdsourcing and SLAM methods for improving the efficiency of constructing and updating magnetic maps.We presented state-of-the-art methods based on magnetic landmarks, DTW, magnetic field fingerprinting, filtering, SLAM, and neural networks and then compared their usage scenarios and localization performance.We compare the advantages of magnetic fields with Wi-Fi, Bluetooth, GSM, FM, camera, acoustics, inertial sensors and their practical applications in industries, highlighting the applications, challenges, and prospects of magnetic-field-based localization.Finally, we summarized the smartphone PDA method with a detailed description of step detection, step length estimation, and step direction estimation.
An overview of the advantages and challenges of magnetic-field-based indoor localization; • Representations and transformations of magnetic fields in different coordinate systems; • A review of magnetometer calibration algorithms and magnetic map constructions; • State-of-the-art indoor localization systems based on magnetic fingerprinting; • A comprehensive study of smartphone-based pedestrian dead reckoning; • A spotlight on new applications and related research opportunities based on magnetic field-based localization.

Figure 3 .
Soft and hard iron effects: (a) soft iron effect; (b) hard iron effect.

Figure 7 .
Figure 7. Summary of indoor positioning methods based on magnetic fingerprinting.

Figure 9 .
Figure 9. Machine learning scheme for indoor positioning.

Table 2 .
Overview of existing publicly available datasets.

Table 3 .
Comparison of calibration algorithms.

Table 5 .
Comparison of SLAM methods

Table 6 .
Comparison on NN-based localization methods.

Table 7 .
Comparison of magnetic field with other techniques for smartphone-based indoor localization.

Table 8 .
Commercial applications based on magnetic positioning of smartphone.