About the ‘ge0.at’ link format

Posted by Dirk Holtwick on 2009-07-22 – 09:20
Filed under News

After having seen the Twittwoch videos I realized that there is an interest in knowing what the link in your tweets is all about. I will try to explain it in two steps:

From a users view

We use the short link to identify the location you refer to and to connect the tweet with the Twittori service. We do not use the domain http://www.twittori.com but the domain http://ge0.at just because it is shorter (minus 10 characters). The six characters that follow the domain name contain the whole geo location information. That means it is not done like tinyurl.com, bit.ly or is.gd do it by  adding a new reference to their database. Instead you can calculate the corresponding latitude and longitude of the position from the six characters itself. The following section describes how this is done.

From a technical view

Basically we use the Geohash algorithm for calculating our location hash. We just expanded this technique to use 64 characters in place of 32 characters. Here you can see the implementation in Javascript to calculate the latitude and longitude from the hash:

var BITS = [32, 16, 8, 4, 2, 1];
var BASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";

function refine_interval(interval, cd, mask){
    if (cd & mask)
        interval[0] = (interval[0] + interval[1]) / 2;
        interval[1] = (interval[0] + interval[1]) / 2;

function decodeGeoHash(geohash){
    var is_even = 1;
    var lat = [];
    var lon = [];
    lat[0] = -90.0;
    lat[1] = 90.0;
    lon[0] = -180.0;
    lon[1] = 180.0;
    lat_err = 90.0;
    lon_err = 180.0;

    for (i = 0; i < geohash.length; i++) {
        c = geohash.charAt(i);
        cd = BASE.indexOf(c);
        for (j = 0; j < 6; j++) {
            mask = BITS[j];
            if (is_even) {
                lon_err /= 2;
                refine_interval(lon, cd, mask);
            else {
                lat_err /= 2;
                refine_interval(lat, cd, mask);
            is_even = !is_even;
    lat[2] = (lat[0] + lat[1]) / 2;
    lon[2] = (lon[0] + lon[1]) / 2;

    return {
        lat: lat[2],
        lon: lon[2]

I wrote a little demo to show this in action. Follow this link: http://www.twittori.com/geohash.html#0BOdWE

Cet article a été publié dans Uncategorized. Ajoutez ce permalien à vos favoris.

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s