

Using HTML5 geolocation API to get the distance of the visitor from me - mihar
http://breakthebit.org/post/10512237123/using-html5-geolocation-api-to-get-the-distance-of-the

======
klinquist
The author is incorrect about that being html5 - it's javascript.

I did this over two years ago with the same js call - I work for a company
with multiple buildings. Go to a web page and you'll see a list of conference
rooms in the buildings you are closest to and their availability. Found a web
page to batch convert addresses to lat/long - made it pretty easy.

Here's something I wrote at the same time that shows your proximity to a city
zip code.

<http://www.linquist.net/geo.php>

~~~
Volpe
No, he is right. It is html5 (or commonly referred to as such). html5 is used
to describe more than just the markup, it is also used to describe, location
services, localStorage, etc.

------
abava
You can see that on the map. Visiting <http://wayn.linkstore.ru> (on phones
with Javascript support) will open the phone's email app with a canned message
titled "Where are you now?" and a link to GeoMail in the email body. If the
recipient is using a phone that supports the HTML5 location provider API, such
as an Android or Samsung Bada device or an iPhone, when they click the link it
will launch GeoMail webapp which lets them reply with a link to a Google Map
showing their location.

------
tadruj
Since JavaScript has 64-bit floating points you could use simpler Spherical
law of Cosines (cos c = cos a cos b + sin a sin b cos C) instead of Haversine
to calculate distance.

------
obtino
Geolocation is not a part of the HTML5 specification!

------
sleepyhead
But please don't do this. "X.com wants to know your location - Ok - Cancel".
Meh.

~~~
Tichy
What do you mean? That dialog can not be affected by the developer, afaik. It
is hardcoded in the browser.

~~~
mihar
Yeah it's hardcoded, more, the OS X Lion takes it to the system level, by
showing a location services activity in the menu bar when you do this.

