How the iPhone knows where you are

This article was published on by Glenn Fleishman. He explains in very precise and didactic way location services of Apple iPhone and iPad and sheds light on the data that Apple gets on our devices. As sometimes a small dose of theoretical knowledge does not affect, I will book the full translation here. The source is available via this link :

Take time, is long enough…

Apple uses the GPS, Wi-Fi, and cell towers to get (and map) location data.

par Glenn Fleishman, 28 April 2011 16:00

The user experience of iPhone with GPS is so fast, if instantaneous, the response from Apple on Wednesday about localization on iOS might almost seem confusing :

"Calculating a phone's location using only GPS satellite data can take up to several minutes.. The iPhone can reduce this time to seconds using Wi-Fi hotspots and data from cell phone antennas to quickly find GPS satellites. "

A few minutes ? My iPhone does he not just a few seconds to find where I am ?

Well, yes… but only when he engages in a series of "tricks" to avoid a long process that was de rigueur when the first GPS receivers appeared. Simplifying things, Apple is not quite clear on how it all works and what it does. So let me explain where the Wi-Fi and cell phone antennas are part of the equation.

12,5 minutes to locate

The first put GPS receivers 12,5 minutes from a cold start to lock position. Other locations, after some time in the same region, could still take several minutes. If you put a GPS receiver off for several weeks or if you had moved a few hundred kilometers, a cold start could be needed again.

The GPS is based on two factors to create a set of precise coordinates of where you stand : time and space. GPS satellites broadcast precise time signals, using an atomic clock built, associated with their current position. They also broadcast the position of all other satellites in the sky, c’est l’éphéméride [the constellation (*)].

All 30 seconds, a GPS satellite transmits a time stamp, its current position and location information for other less precise GPS satellite. Needed 25 these emissions (therefore 12,5 minutes) for a complete list of satellite positions. This information must be decoded to a receiver can then correctly interpret the signals from satellites that are within his reach.

If you know the position of four satellites and the time at which each sent its position information, yourself, or rather your GPS receiver, can calculate within 10 meters latitude, longitude and altitude of your current location with the exact time. With three satellites, you lose elevation, but a device can still track the movement in some states. The standalone GPS receivers can simultaneously receive multiple satellite, and monitor more than four. Other techniques can also improve the precision.

But, devil, I do not 12,5 minutes. I'm a busy man ! Give me the location faster !

Provide assistance to GPS

So, chipmakers and GPS components came with a lot of ways to shorten the waiting time, called Assisted GPS (A-GPS). Instead of relying on downloads live satellite positioning data, Future locations can be estimated with sufficient precision to determine the positions of the satellites coarse, and get a fix every point where updated information is retrieved. These estimates may be downloaded via a network connection in seconds or even calculated directly on the receiver.

Time can also be used as an indicator. With a specific time, Partial satellite data can be decoded to get a lock faster or retrieve the appropriate information to use. In CDMA networks, as used by Verizon, atomic time synchronized GPS is required for basic operation of the network, This fact makes this information available. (Actually, the CDMA cellular phone antennas incorporate GPS units to maintain a better atomic clock synchronization.)

These additional features are what make A-GPS GPS. Although many people misunderstand and think A-GPS it is a fake GPS, this is not the case : A-GPS requires a GPS receiver to operate. The 3G iPhone and Apple iPad incorporate a chip A-GPS, like almost all competing devices equipped with GPS, including mobile Android. (A-GPS allows the use of GPS circuits much cheaper and simpler in phones, reducing costs and losses of the battery.)

This is where Apple's Wednesday statement deviates from optimal precision. Apple is using A-GPS for improvements native GPS lock, the Wi-Fi and location of cellular antennas are additional factors providing an initial connection faster while improving the accuracy of GPS.

Cellular network providers have a measure highly accurate GPS location of all their antennas. With a database of these antennas, You can take measures signal strength from those within range of each other – which can be tens – by trilateration to locate an area of ​​overlap between them. (The trilatération overlapping triangles used to determine an area of ​​intersection, the triangulation uses the angles and distances to determine a central point).

But the cell phone antennas are too far apart to provide an accuracy of GPS type, and they do not work well in less populated areas, even the suburbs, where coverage is less necessary than in an urban environment.

In search of Wi-Fi

Apple, Google and others are turning to Wi-Fi positioning for that. Positioning Wi-Fi, developed by Skyhook Wireless, asked the original vehicle specially equipped with Wi-Fi antennas and ultra sensitive GPS receiver that circulated around the city to meet the network identifiers (unique hardware address broadcast by base stations Wi-Fi) and the relative intensities of the signal to billions of points. As with cell phone antennas, if you have enough network and enough information about the signal strength, you could determine an approximate position.

It is very easy for a network device like a smartphone to take a snapshot of data Wi-Fi and cellular sources nearby and transmit them to a server that responds with an approximate set of coordinates. According to the Q&R d'Apple, the company goes one step further by caching subsets of data networks and antennas close to reduce network activity and speed up these queries. This also moves some calculations on the phone or shelf outside location services. And that means if there is no cellular connection or Wi-Fi, this location information can already be useful. (This explains a mystery that I saw in which a single wireless iPad or iPod Touch can apparently calculate a position when it is off-grid).

iphone gpsApple a, first, unveiled the Wi - Fi positioning and cellular with the original iPhone in an iPhone iOS update at the beginning of 2008. It was love sponge of the fact that Apple's original iPhone does not have GPS, which has started with the iPhone 3G.

You can see either of these functions in action when you launch the Maps application. In general, you see a large blue circle appearing almost instantly, as a result of what must be a consultation of the local database. The circle shrinks as more information is used, still from sources cellular and Wi - Fi, to create a better trilateration. These data are also used to provide more clues in decoding the best information from GPS satellites, allowing the use of very small fragments of data or even raw signals to obtain a better lock. At last, the circle becomes a single point when IOS is convinced he got a solid GPS lock. (**)

Purpose vehicle, entry into the cloud

Apple has abandoned Skyhook Wireless as a data provider from iOS 4.0 for iPod Touch and iPhone, and update 3.2 only for the iPad. There is a reason. When your device uses iOS positioning Wi-Fi, it sends an overview of the landscape of current signals to Apple, who says in the Q&R that this information is used anonymously collected data for better. But it's also an incredible source of valuable marketing information, the frequency with which users rely on updates to localization, and where these users are grouped. It can be used for targeting advertisements and for other purposes in addition to the applications seeking location data.

Course, Q&R Apple says clearly that all instant Wi-Fi are not sent to Apple. Some algorithms control those who are sent to improve the database. With sources collected, Apple avoids having to send trucks on the road. Google has apparently hired the same approach, using its vehicles Street View to supplement the sources collected by Android. (They met two kinds of difficulties in this regard. First of all, for apparently accidentally saved unencrypted data Wi-Fi, which led to fines, decisions and stop this type of analysis in many countries. Second, for allegedly violently prompted two major handset manufacturers to change their deals to be based on data from Google).

GPS, in fact, rocket science multistage. But how Apple combines and complements the information from multiple sources to create a quick locking and accurate for us why, as users, it's "all GPS" and works perfectly.

Glenn Fleishman is a major contributor to Macworld, He writes regularly about wireless data. His latest book is "Take Control of iPhone and iPod touch Networking" & Security, iOS 4 Editing » (Take Control Ebooks).

(*) Translator's Note.
(**) See article iPhone built-in GPS : some details