Google last week opened two new services that developers can utilize to build services into Web sites that employ a site user’s location. Google’s first service announced is an efficient new way for you to grab the user’s location information via Geolocation API for Windows Mobile phones running Google Gears.
The new Geolocation API has already been selected by two third-party developers to create apps for Windows Mobile. European travel site lastminute.com used the platform to develop an app for locating nearby restaurants, while social discovery engine Rummble created an app that allows users find nearby locations recommended by friends.
It is the ClientLocation property of their Ajax API. All you need is a free API key, and then you can load their JavaScript file in your HTML, and access the properties city, country, country code, region, and latitude/ longitude (where available, that is -– the values may not always be found by Google, and Google disclaims they are only “approximate”).
The Ajax client location property provides Web sites with a rough estimate of a user’s location based on his or Internet Protocol address, said Google engineer Steve Block on the Google Code blog. The property can be seen in action in the “news by state” feature on Google’s 2008 election site API (application programming interface).
With this information in hand you can then feed it back to other services, including the Google Maps API, or say an image search for the city name — take a look at the example page called “Where are you?” I’ve created. The only thing officially missing seems to be a server-side way to access the geolocation data.
However, not every person wishes Google to know where they are, though, and Google says the Geolocation API takes this into account.
“The privacy of users’ location information is extremely important. The first time your site calls the Geolocation API to request a user’s location, that user will be shown a permissions dialog box where they can choose to allow or deny your site access,” Block said. “Users can change that decision at any time via the (Gears settings) dialog in the browser menu. Google does not keep location information about users when your site uses the Geolocation API.”
Second is an expected change to endow Google’s Gears software with the ability to employ more detailed location information. Google in their blog post on this says the data returned here is more precise than what the Ajax API delivers. However, this Geolocation API is only available to browsers with the Gears plug-in installed; Gears enables a variety of features such as offline browsing that make browsers a better foundation for rich Web applications.
“On mobile devices with Gears installed, the Geolocation API can use the cell-ID of nearby cell towers or on-board GPS (if either is available) to improve the position fix. In the near future, we also integrate data from nearby WiFi connections to improve accuracy even further, on both desktop and mobile,” Block said.
For now, Gears only works with Firefox, IE, and IE Mobile and only on select Windows Mobile phones.
Looking at the list of supported phones, it is noteworthy that very few of them can actually perform location detection via GPS, though the list of phones that can support detection via cell-ID is relatively large.
There is no information available about when (or if) it will become available on other platforms, though Google’s Android will probably implement it as well.
Google’s boss Eric Schmidt is a self-proclaimed Machiavelli fan, and Machiavelli once posed the question of whether for a leader it’s better to be feared or loved. I think Google answered the question for themselves: in today’s free-roaming web environment, it’s clearly much better for them to be loved.