This question concerns the physics behind the implementation of electronic compasses to find the orientation of a device.
In the robotics community, 3-axis magnetometers are often used for this purpose. After some calibration, these provide a three-dimensional vector indicating the direction of the earth's magnetic field relative to the sensor.
As a second step, apparently a process called "tilt" detection is carried out. This uses a 3-axis accelerometer to measure the vector of earths gravitational field relative to the sensor and use it to determine roll and pitch of the device.
The roll and pitch angles are then used to somehow "compensate" the magnetic measurement for the tilt of the device.
What is the purpose of this tilt compensation? Why is it needed? Could it not be made obsolete by combining the position data from a gps with earth magnetic maps?
Am I understanding correctly when concluding that at the equator no tilt correction is necessary while close to the poles the errors are large without tilt correction?
I am not looking for implementation details but a easy to understand physics reasoning of what the problems are that are being solved by the "tilt compensation" and what alternative solutions are to measuring the earthy gravity field.