# Calculation between Raw GPS data to latitude,longitude points?

I am working on the GPS related project. The objective is to understand the calculation process of the raw GPS data (server side calculation). It means " How did we get the latitude and the longitude points from GPS raw data (the converion between the Raw GPS data to latitude and longitude points).I have been searching for the material related to this. But still can't find one.

Go to the European Space Agency's GNSS Tools site, and download the GNSS Data Processing eBooks and open source tools. They provide good introductory materials on the topic you are interested in.

1. The so-called "GPS raw data" are actually the pseudoranges, carrier cycle counts, dopplers, and etc for the L1 and (optionally) L2 and L5 bands for every satellites tracked by the GNSS receiver. Textbooks call them the GPS/GLONASS/Beidou (or just GNSS) observables. The true raw data are coded radio waves.

2. You need specialized equipment that can output such observables. The smartphones can't, unless they are equipped with specialized chips. For example - I work with the Trimble R8s.

3. The computation on the GNSS observables into coordinates (i.e., lat/long) is called positioning. And, there are many kinds of positioning, e.g., autonomous, differential, relative, precise, and etc.

The positioning done by recreational devices and mobile phones is the autonomous positioning. On the smartphone, the GNSS chip performs this positioning. There is no "server-side".

Here are the general steps that a GPS receiver executes in order to calculate a position.

First, the receiver has to synchronize its clock. For this it needs to collect data from at least 4 satellites, to trilaterate a rough position, and synchronize the receiver clock. The satellites emit information about their onboard time with atomic clocks, their position (ephemeris) and other error corrections, which GPS receivers use to solve 4 variables (ECEF 3D position X, Y, Z and Time).

Once the clock is synchronized within a minimum initial accuracy, the receiver continues to pick up satellite signals and gets pseudoranges, doppler and noise values, which can be used to solve the time and pinpoint the location with better accuracy. GPS receivers emit the same encoded signal as the satellites, and compare the phases of the signals to assess the elapsed propagation time since the moment the satellite emitted the code, then knowing the speed of light, evaluate the distace as `c (speed of light) * t (elapsed time) + other corrections`. The whole process involves several other details and algorithms, which I am not going to go through here, but further reading can be done on several websites such as the MIT OpenCourseWare GPS Course, or with Purdue University, and many others.

The last trivial step is to convert the X, Y, Z coordinates to Latitude (φ), Longitude (λ) and Height (h), which can be displayed. For this, an algorithm such as this one is used:

``````a = 6378137.0 | semimajor axis of the WGS84 ellipsoid
f = 1 / 298.257223563
b = a * (1 - f) | semiminor axis of the WGS84 ellipsoid
e_sqr = 1 - (b^2 / a^2) | eccentricity squared
e2_sqr = (a^2 / b^2) - 1 | second eccentricity squared
p = Sqrt(X^2 + Y^2)
θ = atan(Za / pb)

φ = atan((Z + e2_sqr * b * sin(θ)^3) / (p - e_sqr * a * cos(θ)^3)) | Latitude
λ = atan2(Y, X) | Longitude
h = p / cos(φ) - a / Sqrt(1 - e_sqr * sin(φ)^2) | Ellipsoidal height
``````