# Bright Blue Dot: Introduction to GPS

Navmatic Oct 18, 2020·5 min read

*The Global Positioning System (GPS) has gone from must-have technology to default technology. We assume our phones, cars, cameras, and refrigerators have GPS and we expect it to just work. But behind the simple blue dot on our map app is a complex system of technologies that work together to try to estimate where we are. Even though most positioning systems today use a hybrid of technologies, most people still colloquially call the blue dot “GPS”.*

By __Ben Segal__ CTO at Navmatic

Photo by Jake Davies

As you wait for your rideshare car to arrive, the app alerts you that your driver is nearby. Looking at the map, you can see that the driver has pulled up right where you are. But wait — the blue dot on the map is a block away and across the street from where you’re actually standing. Suddenly the blue dot jumps back in your direction and now both you and the driver are confused about where to meet. Why does the blue dot jump around? Why is it so inaccurate when you’re downtown?

In this blog post we’ll dive into the basic principles behind how GPS works (when everything goes right). In subsequent blog posts we’ll dig into some of the reasons why GPS and other positioning technologies can fail, and how we can improve them.

## Trilateration

At its core, GPS is conceptually a simple system. GPS provides a ubiquitous signal across Earth that allows anyone with an inexpensive receiver to determine their absolute 3D location (latitude, longitude, and altitude) in a few seconds.

GPS uses a geometric technique known as trilateration in order to solve for these three unknown values. To illustrate how trilateration works, we’ll show a simple 2D example on a map.

Trilateration involves making distance measurements between known locations and the location we’re trying to determine. For example, let’s say you knew you were 119.78 km away from Sacramento. That would mean you could be located anywhere on the orange circle.

That’s helpful, because it narrows down where you are, somewhat, but it doesn’t tell you if you’re in Kirkwood, San Francisco, or Clearlake. Let’s make another distance measurement: 68.05 km from San Jose.

If both of these measurements are true, we must be where the two circles intersect, which is in two places: San Francisco OR somewhere on highway I-5, west of Turlock.

In practice, we typically can exclude one of these possible points given other knowledge we have or by using a third distance measurement. In this case let’s say we can see the ocean — that means we must be in San Francisco.

## Back to GPS

With GPS, we calculate our distance to multiple satellites and apply the same trilateration technique to locate ourselves. But how do we know how far away the satellites are? And while we know where Sacramento is, how do we know where a satellite moving at four kilometers per second is?

## Measuring Distance = Measuring Time

When it comes to GPS, we don’t directly measure distance to the satellite, but rather time. GPS satellites broadcast an electromagnetic signal which travels at the speed of light. Since we know that the speed of light in a vacuum is constant, we can easily relate time and distance:

*distance = time difference * speed of light*

The time we measure represents how long it takes for the GPS signal to travel to Earth.

*time difference = time the signal was received on Earth — time the signal left the satellite*

The satellite encodes the time it sent the signal in the signal’s message and we can log the time we see when we receive the signal. The difference between these two times is how long it took the signal to travel through space.

## (Precisely Measuring) Time is Money

The approximate speed of light is 186,000 miles per second. To be able to locate ourselves down to a few feet means we need nanosecond level resolution on our clock since light travels one foot in one nanosecond.

However, measuring time down to a few nanoseconds is expensive. Each satellite contains multiple atomic clocks to track time very precisely, but it’s not practical or feasible to put an expensive atomic clock in every GPS receiver.

Instead, the GPS receiver in our pocket has a low cost, noisy clock that is offset from the true time by some unknown amount. This unknown offset in the time shows up as an error in the measurement to every satellite. Since the time offset is consistent across measurements, we also solve for the time error in the GPS receiver just as we solve for latitude, longitude, and altitude. Solving for this fourth unknown requires a distance measurement to a fourth satellite.

## Ephemeris

Now that we have the distance to each satellite, we’re almost ready to solve for our position. The final piece of information we need is the location of the satellite, precisely at the moment that it transmitted the signal. To do this efficiently, the GPS satellites broadcast a set of data known as the Ephemeris, which describes the satellite’s position in its orbit around the Earth as a function of time. The user takes this information, plugs in the time the satellite transmitted its signal, and determines the precise location of the satellite at that time.

## From Circles to Spheres

Finally, we have everything we need to solve for our location on Earth. Since we’re in 3D space, not on a 2D map, we construct four intersecting spheres, centered around the satellites, and find where they all intersect. This is our location.

## Broken Assumptions

Given the simple description above, why doesn’t GPS always work perfectly? It comes down to the assumptions we make.

For example, as mentioned above, the speed of light in a vacuum is constant. But we don’t live in a vacuum. Between us and the satellites is Earth’s atmosphere which slows down the speed of light. To get high accuracy, we explicitly model the components of the Earth’s atmosphere to estimate how much each layer slows down the GPS signal. Similarly, the Ephemeris isn’t perfect, so where we think the satellite is and where it actually is are slightly different.

**Each of these inconsistencies can lead to an error in the position estimated. Some errors are larger, some are more random, some depend on the weather, some depend on the Sun. In subsequent blog posts, we’ll dive into some of the main sources of error a micromobility positioning system encounters and how we can mitigate them.**