Unofficial news and tips about Google

August 22, 2008

APIs for Finding Location

Google launched two APIs for finding the location of a user from a web application. The most simple way, which is also the least precise, is to derive some information about location from the IP. Google AJAX API has an object named google.loader.ClientLocation that includes "metro-level granularity properties": country, region, city, low resolution latitude and longitude. This could be useful if you want to customize a web page for a specific country or to prefill information about location. You probably noticed that google.com automatically redirects to the appropriate international domain and that when you create a Google account your country is already selected.

To get a more precise location, you could use the new Geolocation API from Gears 0.4. "The Geolocation module provides the best estimate of the user's position using a number of sources (called location providers). These providers may be onboard (GPS for example) or server-based (a network location provider)." The API includes a method that lets you track the changes and perform an action based on the new location. Unlike the AJAX API, this requires that users have Gears 0.4 installed and they explicitly allow the application to obtain location information. Unfortunately, Gears is only available for Firefox, IE and IE Mobile, but the team promises to extend the availability to other browsers. Gears for Safari will soon be released, so S60 and iPhone support shouldn't be far away. Google Mobile Blog has two examples of sites that already use the Gears API.

Meanwhile, Yahoo has developed a very interesting platform called Fire Eagle which connects the applications that obtain location information to other application that use the information. "The service has two major functions for users—it allows a user to update their location and then gives them full control of how and where they share that location. A user can perform these functions on the central site, but can also update or access their location data using any other authorized 3rd party application - on the web, on a desktop application or on a mobile device."

As more people start to use Internet services on mobile phones and the devices become more capable, location will be used in almost all applications to deliver more relevant information: a social network could displays the friends near you, a photo sharing service could show photos taken near your location, while a shopping search site could find the best price for a professional digital camera in your area. You can already find interesting applications for Symbian S60, iPhone, Android, but they will become really useful when everyone will broadcast the location.