Twittori - Geotags for Twitter status messages

Twittori.com is our current project that adds geo tagging to Twitter messages. It is very easy to use and intends to bring a more useable geo dimension into the Twitter World.

logo-twittori

I started a little service that adds geo location informations to single Twitter status messages.

Unlike other services this is done by a tiny URL that itself contains all geo location informations e.g. http://GE0.at/0MbEX8 which locates the Eiffel Tower in Paris. This is achieved by a modified 'geohash' algorithm (more on that at Wikipedia).

The second unique feature is that users can follow places in a similar way than they are used to follow users on Twitter. Therefore the earth is divided in discrete squares of about 0.25 square kilometers. You can keep updated by subscribing to a RSS Feed or visiting the web site.

An iPhone application is also ready but not yet approved by the Apple App Store. In the meanwhile you can watch a little demo on the web site under the 'iPhone' menu entry.

I hope this is an interesting project for the readers of Mashable. The URL of the project is http://www.twittori.com

Unlike other services this is done by a tiny URL that itself contains all geo location informations e.g. http://GE0.at/0MbEX8 which locates the Eiffel Tower in Paris. This is achieved by a modified 'geohash' algorithm (more on that at Wikipedia).

The second unique feature is that users can follow places in a similar way than they are used to follow users on Twitter. Therefore the earth is divided in discrete squares of about 0.25 square kilometers. You can keep updated by subscribing to a RSS Feed or visiting the web site.

The Website

The web site has been designed by Martin "Datendesigner" Jacobs. It aims to be clear and simple to use.

The iPhone App

The iPhone App is waiting to become approved for the App Store. It is very easy to use and provides a well defined user interface. A little demo on Twittori.com shows the details: http://www.twittori.com/content/iphone

Screenshot Twittori

The Technology

The Google App Engine is used for hosting. Therefore the server side code is written in Python. For the AJAX stuff we use Google Maps, Google Gears, jQuery, jQueryTools scrollable, jQuery mousewheel, prettyPhoto. The CSS is based on Blueprint CSS Framework.

The Shortlink

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;
    else
        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