Story

I knew about Google Latitude from a friend when I bought my HTC mobile. I used it a few times before I updated my ROM to a cooked ROM that has no Google Latitude app installed. The story begins when I noticed by chance that my Google Latitude gadget on iGoogle reflected my location although I had not accessed Google Latitude from my mobile recently. I Googled for geo features of Google Gears and discovered that they are able to give you your location using Wi-Fi towers only. What follows is a discussion about Google Gears geo features and a proposal of how it might work. I developed a tool as a proof-of-concept of how can we use Wi-Fi geo location directly using a simple C# application.

Introduction

The article is divided into two sections. The first section is an investigation and ideas about how Google can get geo location using only local Wi-Fi! The second part is the coding part, in which we make an application that uses Google services to get geo location.

Background

First, try to connect your computer to a wired network - no Wi-Fi - and then try to find your location using Google Latitude. Google will give you "Unknown Location" as it will not be able to locate your location. Switch the very same computer to a Wi-Fi connection and use Google Latitude again. Now the result will be completely different - Google can give you accurate coordinates of your location. That means the location cannot be determined by the IP address only. Using IP, you can know the country, city, and regions in case you know from ISPs how they distribute their IPs geographically.

The second thing I heard about is that BBC has a service that gives you weather information based on your location that it gets from Google Gear. I decided to monitor HTTP traffic using a tool such as Fiddler. I was looking for:

What data is retrieved from my PC in order to locate my location?

How does BBC communicate with the Google location service via my PC?

The BBC weather site downloads JavaScript to my PC that locally calls Google Gears, and then Google calculates my location and sends it to the BBC website. The following figure shows this information. As we can see, Google Gears collects all Wi-Fi towers that can be detected from my PC in the following form: { mac_address , signal_strength, SSID}.

This data is sent in JSON format to www.google.com/loc/json and Google replies with my latitude, longitude, and even my own address. The above information that is sent to Google is good enough to roughly locate your position relative to these Wi-Fi towers, but to locate the absolute location, you need to know the absolute location of these Wi-Fi towers!! Again, it is not clear to me how Google knows such information. I made some more investigation and found that in case GSM data is available, this data is also sent together with the Wi-Fi information.

How does Google Gears Geo Location work?

From here, I will try to describe, based on the above info, how Google might use this information to give location information. In the case of GPS, data sent to Google contains:

GPS data

GSM towers

Wi-Fi towers

In the case of a mobile that supports a GPS, it is enough to determine the GSM towers to have accurate info about location. This info is sent to Google as part of the request. But as we can see, this information already contains the geo location, so Google might do the following:

Calculate you location [latitude and longitude].

Use Wi-Fi data to calculate your relative position to each Wi-Fi.

Calculate the absolute position of each Wi-Fi tower based on a and b:

Mobile absolute location is already known.

Wi-Fi relative location from the mobile is known.

Now, Google stores the mac_address and the SSID together with the absolute location in a geo database that is kept updated when possible.

In case you open your laptop and connect to Google Latitude, Google can determine your absolute location using the Wi-Fi towers only because it already knows, from other queries from you and different persons, the absolute location of the Wi-Fi towers. As we can see in the following figure, the blue person sends GPS, GSM towers info, and Wi-Fi towers info. Google calculates the Wi-Fi towers info. Now the green person can know his location by querying Google with Wi-Fi towers only.

This is not that easy. We need to think of many challenges such as similar Wi-Fi names, changing mac-addresses, Wi-Fi turning on/off etc.

Let's Make Our Application

The desktop application that I made here is a POC, and is pretty simple. It works in two steps:

Points of Interest

If the Wi-Fi section is not working with you if you don't have Wi-Fi, you can still use the application by editing the request text to retrieve different locations.

Disclaimer

The above Google technique is only a guess by me based on simple evidence and logic thinking. This document describes the analytical thinking and how I deduced this technique that could be partially or totally untrue.

Hello ,
first i want to tell you thanks for that great project , i'm so intersting to this project but when i build it i find this error The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?)
whitch come from this instruction

Excellent thinking!
Just to add some thoughts :
1. It is strange that http://www.google.com/intl/en_us/latitude/intro.html doesn’t have my Country and lot of others (example: Greece)
2. As anyone can read in the articles
http://gizmodo.com/5543582/google-sued-over-street-view-wi+fi-issue
http://www.wired.com/threatlevel/2010/05/google-street-view-cams/
something smell bad for the activities of Google…

Ps: As a poor Greek person I see some strange cars of Google in major roads at my homeland. I bet, in a few months I will have the service of latitude!!!

Ps2: They love to make giant DB of everything, but they throw to us the possibility to use their Data.

I added Google Latitude and it placed me at my home address!
Since there are no "towers" for WiFi close by, it has to know the position of my own and my neighbors' WiFi routers. How do they do this??? The router itself has no knowledge of where it is!

The router has no idea where his location is.
so I believe that the only solution is that Google already has a DB of mac addresses all over the world linked to there location.
This can be maintained by using GPS & GSM "mobile phone" towers together with wifi data and use the first two to get absolute location then determine wifi absolute locations.
later when you query using the wifi it gives you your location.
I tried to explain this in my topic. pls share with me if you have different ideas.

I'm beginning to think I understand... The hard part was getting the cell phone towers into the mix, but that would happen if my neighbors have iPhones and surf via WiFi while still active on the cell network. (I think.)