1 :: Geolocation

Here’s a demo from w3schools which features a demo that works for my iTouch (using Safari) and my laptop (using Firebox) but doesn’t seem to work from Chrome for my laptop – which really threw me because this feature is pretty much supported by every browser now – even IE.

[At this point I research online and I determine that it is an Ubuntu-Chromium error that should be resolved once Chromium is updated… which prompted me to update my laptop to to Ubuntu 12.10 to see if would change anything (it didn’t). This prompted me to change my default browser to Firefox which required more time setting it all up the way I like. In other words, several hours of yak shaving passed…]

The geolocation API in HTML5 requires latitude and longitude but in decimal form.

This turns (N 42° 18′ 0” W 83° 1′ 1”) into (42.3, -83.017) — as longitude West and latitude South are represented by negative values. Using 6 digits after the decimal point gives around 1 meter accuracy (though this depends on where you are in the world).

Six

It is surprisingly easy to use geolocation. Here’s a code example from HeadFirst HTML5 which returns the text of one’s location with a little bit of html and a little bit of JavaScript: