How Google Maps uses the W3C Geolocation API and Google Location Services
There’s a lot of excitement (sample) about browsers (notably Firefox and Chrome, but actually any implementation that include Google Gears) implementing the W3C Geolocation API. Why? In the past few days Google announced that Google Maps (desktop) can now take advantage of it. All good. My concern: all this discussion may be “fuzzing up” what the API does and does not do.
First off, the API does not determine location. It taps into the preferred “location provider” set by the platform that implements it; it might be GPS, wi-fi, IP, or a combination. Then the API delivers the provided location in a standard way to apps (like Google Maps) that ask platforms (like Firefox) for a location.
It’s the developers of those platforms (Firefox, Chrome, Gears) that determine which “location provider” to use. All three (Firefox, Chrome and Gears) use Google’s tools (Google Location Services) as the default geolocation provider. Google announced that Firefox had chosen Google Location Services back in April. So, if you don’t think your location is right, don’t blame the API, blame the location provider!
Early on Firefox demoed the API implementation with Skyhook’s tools, but in the end opted for Google. Skyhook CEO Ted Morgan discussed Firefox’s choice of Google for determining location in a C|net article this week, saying, “It was a bummer for us, but it’s really too bad for Firefox users since it’s not as good.” Opera, by the way, chose Skyhook (press release).
I raise this detail because reading this from the Google Lat/Long blog might be confusing.
So how does it work? When you activate the My Location feature, Google Maps asks your web browser for your location. Typically, your browser uses information about the Wi-Fi access points around you to estimate your location. If no Wi-Fi access points are in range, or your computer doesn’t have Wi-Fi, it may resort to using your computer’s IP address to get an approximate location. As you’d expect, the accuracy of My Location varies with your location, and in some cases, Google Maps may not be able to provide a location at all.
This from the W3C site for the geolocation API is helpful.
The Geolocation API defines a high-level interface to location information associated only with the device hosting the implementation, such as latitude and longitude. The API itself is agnostic of the underlying location information sources. Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs, as well as user input. No guarantee is given that the API returns the device’s actual location.
Here’s how Firefox says its geolocation works:
How does it work?
When you visit a location-aware website, Firefox will ask you if you want to share your location.
If you consent, Firefox gathers information about nearby wireless access points and your computer’s IP address. Then Firefox sends this information to the default geolocation service provider, Google Location Services, to get an estimate of your location. That location estimate is then shared with the requesting website.
If you say that you do not consent, Firefox will not do anything.
For more information I recommend this Skyhook slidedeck that outlines how the parts are related.