It’s that time of year again where you just want a fun evening in the company of your friends and some nice food. Unfortunately, your friends are busy so all you have left is your fellow .NET developer geeks and a brewery.

That’s right folks; it’s time for the first Copenhagen geek dinner Christmas edition. It’s Thursday, December 18th at 7pm at Brewpub in the center of the city. As usual, ZYB will pay for all the beer and as a special Christmas present, Microsoft will sponsor the food. You might have to pay a small amount depending on how many we are going to be, but it will not ruin your budget.

There is only room for 20 people, so sign up right now.

The W3C has created a standard for location sharing called Geolocation. It allows any person to share her location with any website at the click of a button. Imagine the possibilities with this.

Here is a scenario:

You’ve arrived in a new city, a new continent, a new coffee shop. You don’t really know where you are, and are looking for a good place to eat. You pull out your laptop, fire up Firefox, and go to your favorite review site. It automatically deduces your location, and serves up some delicious suggestions a couple blocks away and plots directions there.

Firefox 3.1 will have this build in, but until then we can use a Firefox add-on called Geode. Basically, it uses your Wi-Fi network to find your exact location and then passes it to a JavaScript callback method on your website. Already now, services like Pownce, Fire Eagle and ZYB uses this to improve the user experience of their services.

Here is a screenshot of what it looks like when Geode ask for a location:

Geode add-on

Getting started using Geode

You should start by downloading the Geode add-on for Firefox and make sure your Wi-Fi is turned on. Then fire up your HTML editor and add this JavaScript to one of your pages:

function geodeAsk()
{
 if (navigator.geolocation)
  navigator.geolocation.getCurrentPosition(geoFound, geoNotFound);
}

function geoFound(pos)
{
 var lat = pos.latitude;
 var lon = pos.longitude;
 alert(lat + ', ' + lon);
}

function geoNotFound()
{
 alert('You must be on a wifi network for us to determine your location');
}   

// Ask the browser for its location
geodeAsk();


Open the page in Firefox. Geode will now ask you if you want to share your location with the page. It’s that simple. Geode then sends the latitude and longitude to the JavaScript callback method and you can now do whatever you want with it. If you want to retrieve the address based on the location, then you need to do a simple reverse GEO lookup.