Google Gears Geolocation API
I spotted this on the All Points Blog.
Google Gears is an open source project that allows you to run web applications while you’re offline. It basically caches data in a SQLite database and has a local store to cache things like JavaScript and HTML. They recently added a Geolocation API to Gears, which allows the user to retrieve their current position (via GPS, cell tower triangulation, or IP address).
The API provides these features:
- One-shot position requests (e.g. for recommendations sites -- "where am I right now?")
- Repeated position updates (e.g. for continuously updating one's location on a map)
- Ability to get the last-known position cheaply before doing an expensive new request
- Compatibility with future use as a singleton in the standard DOM (e.g. window.geolocation)
This didn't do anything for me, but I'm fairly sure I'm doing it wrong.<script type="text/javascript" src="gears_init.js"></script> <script type="text/javascript"> var geo = google.gears.factory.create('beta.geolocation');
function updatePosition(position) {
alert(‘Current lat/lon is: ‘ + position.latitude + ‘,’ + position.longitude);
}function handleError(positionError) {
alert(‘Attempt to get location failed: ‘ + positionError.message);
}geo.getCurrentPosition(updatePosition, handleError);
</script>
This is similar to the Fire Eagle Yahoo! service I blogged about last month. The usual we keep your data private message is being trumpeted by Google, while I continue with my creepy creepy creepy summation on the matter.