So guys before we move forward first of all we'll talk about What actually GPS is ? Well According to Wikipedia "The Global Positioning System (GPS) is a space-based satellite navigation system that provides real time location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites."
The global positioning system was originally created by the United State for military use, but was eventually opened up to civilian use. At least 24 GPS satellites are always in orbit around the Earth, and they’re constantly broadcasting data.The satellites are arranged in orbit such that four satellites are visible in the sky from any point on Earth. (You can’t actually see them, but there’s a direct path for the radio transmissions.) This means that GPS won’t work if the signals are being blocked – you will want a fairly direct path between you and the sky. In an underground bunker or in a cave under a mountain, it won’t work.
GPS satellites are constantly transmitting radio signals towards the Earth. Each transmission includes the location of the GPS satellite and the time the signal was sent.
How GPS Determines Your Location
A device with built-in GPS – whether it’s a dedicated in-car GPS navigation unit or a smartphone – only acts as a GPS receiver. A device with GPS isn’t actually “contacting” satellites to determine its location. Instead, it’s just listening for the radio signals that are being broadcast from these satellites all the time.
A GPS receiver “listens” for signals from four or more satellites. Signals from the closer satellites will arrive sooner, while signals from the farther satellites will arrive later. (The actual time difference is very small, but can be detected by the GPS receiver.) By comparing the time the signal was broadcast and the time the signal arrived, the receiver can estimate its relative distance from all four satellites. Using "Trilateration", the receiver can then determine its location.
What is Trilateration
Trilateration may sound a bit complicated, but it’s actually fairly simple. Imagine if someone told you you were 500 miles from New York, 800 miles from Miami, and 700 miles from Kansas City. With this information, you could determine a region that is the correct distance from all of these cities and estimate your current location.That’s trilateration in a nutshell, and it’s what GPS receivers are doing whenever you use them.
GPS Accuracy
The accuracy of a position determined with GPS depends on the type of receiver. Most consumer GPS units have an accuracy of about +/-10m. Other types of receivers use a method called Differential GPS (DGPS) to obtain much higher accuracy. DGPS requires an additional receiver fixed at a known location nearby. Observations made by the stationary receiver are used to correct positions recorded by the roving units, producing an accuracy greater than 1 meter.