Where are you?

Last weekend I’ve been working on a new project. Since I already had some experience  generating KML files for use with Google Earth (wikileaks projects!) I started to think of something else that I could visualize… perhaps see where my friends are?

Because I’m using Facebook to connect with my friends, I decided to dig into the documentation of the facebook APIs. Apparently there are multiple ways to get hold of your and your friends information. The most commonly used APIs are: Graph API / FQL . The first one lets you retrieve information about a friend or page by loading a specific URL, the second one lets you actually send a SQL query to retrieve the  information.

Since I want to make this a hassle free experience, I decided to make a Facebook application which would use the Google Earth Web plugin. This way, users only need to download the plugin, but everything works just in the browser.

Finding friends on Google Earth

How does it work?

Basically a Facebook app is just a website running on some server. In my case, I’m hosting my application on the same domain as my blog. Since the application is embedded into the Facebook website, normal users won’t notice. The app itself can be written in all kinds of languages but for the sake of simplicity I used PHP.

First we need to connect to Facebook using an API/SDK. This allows us to authenticate and securely connect to the Facebook servers. After enstablishing a connection, we use FQL to query: Our friendslist and the location of our friends. Unfortunately the friendslist only contains the name of the location and not the geospatial coordinates.

Therefor I had to create a lookup database that would translate a City/State/Country name into a geospatial coordinate (latitude and longitude). This was done by downloading a free database from Maxmind.com.

Now we should have all data available to create our KML file on the fly. For now I embed the KML result into the javascript header which seems to work fine for ~200 friends. I still need to do some benchmarks to see how well this scales. A demonstration video of the result can be found below:


Can I try?

Since this project is still WIP, it is not available yet in the Facebook Application Directory. I’m planning to release this application for free soon.

6 Comment


    thats one cool app man

    23 Dec 2011 | Reply

  1. This is a most excellent application that you have made, currently I just make my own placemarks to show where my Global Outreach friends are, but it would be great to see all my facebook friends. My only concern would be security, where others might be able to see all my friends, or where they are etc. I am interested in seeing a KMZ of this, please email me anything you can, or any other neat tools you use. Thanks so much for working on this!

    02 Apr 2012 | Reply

    • Thanks, actually, only you will have access to the data not your friends. The facebook app doesnt post on your wall so there shouldnt be too much privacy issues. The app also allows you to download the KMZ file for private use. (Unfortunately I dont have https hosting on my site, so you might need to temporary disable https in facebook).

      03 Apr 2012 | Reply


    Hi Laurence
    I just got wind of this cool app, please let us know what your estimated date of release is, thanks!

    18 Sep 2012 | Reply

    Leave a reply