[whatwg] Geolocation in the browser

Ryan Sarver rsarver at skyhookwireless.com
Fri Feb 23 11:52:37 PST 2007


I agree with you on the idea of not always using lat/lon as the returned data -- this is how we have it implemented in the upcoming version of Loki to test it out. The inherent problem with this model is that reliance on a reverse-geocoding service to provide that kind of information. If we want to allow existing GPS and NMEA-supporting devices to play in this world, we would need a reverse geocoding service to supplement the lat/lon. Its interesting to think about, but I don't know if its feasible on a broad level.

As for your recommendation on the DOM api, I really like it:


Your use cases and implementation also make sense.

-----Original Message-----
From: Kornel Lesinski [mailto:kornel at osiolki.net] 
Sent: Thursday, February 22, 2007 6:00 PM
To: Ryan Sarver
Cc: whatwg
Subject: Re: [whatwg] Geolocation in the browser

On Wed, 21 Feb 2007 20:31:11 -0000, Ryan Sarver  
<rsarver at skyhookwireless.com> wrote:

> var location = window.getLocation();

For some applications location given in format other than lat/long may be  
more useful and less privacy-sensitive.

For example name of the city might be good enough if you order a cab from  
a nationwide company.
Postcode would be easiest way to integrate location API with existing  
services (especially via userjs/greasemonkey, where using  
location->postcode database may be difficult).
Additionally city/postcode information may be provided to desktop browsers  
by the user (for example Opera collects that information already).

Also different applications may be satisfied with different precision of  
location (searching for nearest airport vs nearest starbucks :)

There's also privacy problem with giving too precise location and  
usability problem with asking for user's permission every time.

My proposal is:

use navigator.getGeolocation instead of window.getLocation to avoid  
conflicts with existing functions (window object is a global namespace in  
JS) and to avoid confusion with window.location object.

navigator.getGeolocation() would return location with best precision  
allowed by default (without asking user every time). If user set in  
preferences that every page can get location with 10km precision, that  
would be returned.

navigator.getGeolocation(100) would request location that has precision of  
100m or better. If user's default allowed precision is lower than the  
specified one, browser would ask for permission. Browser would be allowed  
to return location with lower precision than requested (if it doesn't have  
information precise enough or because user decided so).

The function would return an object, which could be queried about various  
aspects of the location - name of the city, postcode, but also precision  
of location given (so applications would know if user is really exactly in  
the middle of the city or if browser only knows the city name).

regards, Kornel Lesiński

More information about the whatwg mailing list