Enterprise Software

The Geolocation API

The W3C's has proposed a Geolocation API -- an interface that can work out the location of the hosting device. Currently only Firefox is implementing it.

The W3C's has proposed a Geolocation API — an interface that can work out the location of the hosting device. In addition to determining and updating the location, based on latitudes and longitudes the API would attempt to also query cached positions.

Privacy
The ability of the technology to reveal the user's location raises privacy concerns, so it has been proposed that location information should not be released without the user's permission. Websites can then request your location and you have the option of disclosing it or not.

The API

Geolocation Interface
Scripts can access the location of the hosting device through the geolocation object. Methods for retrieving the current position and tracking a user's location are: getCurrentPosition() and watchPosition().

Position Interface
Provides a description of the user's location:

  • Latitude and longitude
  • altitude
  • accuracy
  • altitudeAccuracy
  • heading
  • velocity
  • timestamp

PositionError Interface
Handles errors. It returns the code and the error message.

Some of the scenarios where this API could be useful are:
  • automatically filling out the address fields based on the user's current location
  • showing the user's position on a map
  • getting alerted when locations of interest are close by
  • tagging updates with location information on social networking sites like Facebook.

    • Firefox is currently the only browser that is experimenting with this API. The upcoming 3.1 will include the full version. The user will be able to choose a geolocation service provider, for instance a GPS or a web-based provider.

Editor's Picks

Free Newsletters, In your Inbox