◉ Mobile & IoT

How your smartphone knows where you are: GPS, GNSS, Wi-Fi

GPS and Galileo satellites, A-GPS, dual frequency, Wi-Fi and cell positioning: how the phone calculates its location and why it is sometimes far off.

You open a map and the blue dot appears almost instantly, sometimes accurate to the metre, sometimes surrounded by a circle as wide as a block. Behind that dot, several technologies work together. Knowing how they work helps you understand when to trust the position, why some apps drain the battery and how to improve accuracy.

GNSS: not just GPS

GPS is the name of the US satellite system, but it's now used for the whole category. The correct term is GNSS (Global Navigation Satellite System), which includes:

  • GPS, from the United States;
  • Galileo, from Europe;
  • GLONASS, from Russia;
  • BeiDou, from China.

Modern smartphones receive several constellations at once. More visible satellites mean a steadier position, especially in cities, where buildings block part of the sky.

How the position is calculated

Each satellite continuously broadcasts a signal containing the exact time it was sent and data about its own orbit. The receiver in the phone measures how long the signal takes to arrive and works out its distance from that satellite. With at least four satellites it can calculate latitude, longitude and altitude, and correct the error in its own clock, which is nowhere near as precise as the atomic clocks on board.

The weak point is that the signal arrives extremely faint. It takes very little to disturb it: roofs, tunnels, dense vegetation and above all reflections off buildings. A signal that bounces off a façade travels a longer path and makes the satellite seem further away than it is. That's why in old town centres the dot sometimes jumps to the opposite pavement.

Dual frequency

Many recent phones receive satellite signals on two frequencies (for example the bands known as L1 and L5 for GPS, E1 and E5a for Galileo). Comparing the two frequencies helps correct errors introduced by the atmosphere and makes reflected signals easier to recognise. The practical result is a more reliable position in cities.

A-GPS: a faster start

A receiver starting from scratch has to download orbit data from the satellites, which can take minutes. A-GPS (assisted GPS) downloads this information over the Internet, through the mobile network or Wi-Fi, so the phone immediately knows which satellites to look for and where. That's why you get a position within seconds even after a flight, and more slowly in a place with no connection.

Wi-Fi and cells: location without the sky

Indoors, satellites are hard or impossible to see. The phone then uses other sources:

  • Wi-Fi networks: Google's and Apple's location services maintain huge databases of Wi-Fi networks linked to approximate positions. The phone sees which networks are around, and how strong they are, and estimates where it is, even without connecting to any of them;
  • mobile network cells: the mast the phone is attached to gives a rough position, more precise in cities where cells are small, much less so in the countryside;
  • Bluetooth: small transmitters called beacons can indicate position inside shops, museums or airports.

The operating system combines all these sources with the phone's sensors, such as the accelerometer and compass, and shows the result together with an estimate of uncertainty: that's the blue circle around the dot.

Sources compared

Source Typical accuracy Where it works
GNSS under open sky a few metres outdoors
GNSS in cities from a few metres to tens streets with tall buildings
Wi-Fi from a few metres to tens built-up areas
cells from hundreds of metres to kilometres anywhere with coverage

Accuracy and power use

The satellite receiver uses energy, especially if it stays on for a long time. Navigation and fitness apps keep it running constantly; other apps only ask for a rough position now and then. That's why iOS and Android let you grant each app:

  • precise or only approximate location;
  • access only while the app is in use or all the time.

For a weather app, approximate location is more than enough. Navigation needs precise location, but only while in use.

How to improve an inaccurate fix

  1. Turn Wi-Fi on even without connecting: it helps positioning in cities.
  2. Calibrate the compass when the map points the wrong way, following the app's instructions.
  3. Move towards a more open space if the dot keeps jumping between streets.
  4. Remove metal cases or mounts covering the top of the phone.
  5. Give the app precise location, if it really needs it.

In short

  • The phone receives several satellite systems at once: GPS, Galileo, GLONASS and BeiDou.
  • Errors in cities come mainly from signals reflected off buildings.
  • A-GPS uses the Internet to speed up the start; dual frequency improves accuracy.
  • Indoors, location comes from Wi-Fi networks, cells and Bluetooth beacons.
  • You can give each app only approximate location, and only while it's in use.
MM
Marco Marzaduri

Marco Marzaduri works in cybersecurity, digital forensics and web development. With degrees in computer science and psychology, he combines technical analysis with an understanding of the human factor.

Read also