May 04, 2005

Geotagging Flickr photos, with GoogleMaps via a cool Greasemonkey script and bookmarklet

A guy called revdancatt created a cool new website called GeoBloggers that lets you "geotag" your flickr photos, geotagging means adding longitude and latitude coordinates to the tags for the image. Then his website pulls in the images and overlays them on google maps, its very cool! and will be even cooler for us in the UK when google maps adds the sattelite images for the UK.

I wrote a couple of scripts to help out, making the process a bit easier, one is a Greasemonkey script, that adds 2 links to the google maps page/s.

  • The first link, when clicked, redirects you to the geoblogging website for that location, where all the images tagged with the local coordinates will be listed on the map.
  • The second link, when clicked, displays the longitude and latitude coordinates on the map, which is useful for people who want find the coordinates of where they took their images so they can add the required tags to their flickr images.

Heres the GreaseMonkey Script: GeoTag.Gmaps.Flickr.User.js
UPDATE: Ive updated the greasemonkey script/s you can get the new ones here:

The second script is a javascript bookmarklet, which should work on both Firefox and Internet Explorer. The bookmarklet works the same way as the first link mentioned above, ie when you click the bookmarklet whilst on a google maps page you will be redirected to the associated page on the geoblogging site.

Here the bookmarklet: (*UPDATE* I dont think the bookmarklets below work any more.)

javascript:latlong = _m.map.getCenterLatLng(); latlong += ""; latlong = latlong.replace(/\)/g,""); latlong = latlong.replace(/\(/g,""); latlongarr = latlong.split(', '); location.href = 'http:\/\/geobloggers.com?lat=' + latlongarr[1] +'&lon=' + latlongarr[0];

To get the bookmarklet to work just create a new bookmark/favourite and copy and paste the above code in for the URL. then to use it just hit the bookmark when you are browsing google maps, and you should be redirected to the geoblogging site for that location.

I also wrote another bookmarklet that is based on one listed at http://libgmail.sourceforge.net This one when selected on a google maps page, will display the longitude and latitude coordinates of the current location on the page. Unlike the other version, this one doesnt autoupdate all the time, so its a bit quicker to run, though the downside is the center of the map isnt marked so its harder to get an accurate position for your geotags.

javascript:ll=_m.map.getCenterLatLng();ll +="";ll=ll.replace(/\)/g,"");ll=ll.replace(/\(/g,"");llarr=ll.split(', ');void(document.getElementsByClassName('title')[0].innerHTML='geo:lat='+ llarr[1] + ' ' + 'geo:lon=' + llarr[0]);


UPDATE Ive updated the GreaseMonkey scripts, see GeoTagging Flickr with GoogleMaps PART 2 for more details.


Posted by steeev to Bookmarklets | Cool Software | Cool Websites | Firefox | Flickr | GeoLocation | Google Maps Hacking | GreaseMonkey | Ocular Sweetitudes | Programming | Web Development

at May 4, 2005 03:20 AM
Comments

Per your GM script's own admission, it's a 0.2.6 script. As it turns out, it is not a 0.3.3 or 0.3.4 script.

As Jeremy (Dunck) wrote earlier on the GM list:
[BEGIN QUOTE]
Instead of:

function foo() {
//your code here
}

please change your declarations to:
window.foo = function() {
//your code here
}

We made a scoping change to improve security and allow per-script GM_*
functions.
[END QUOTE]

I wonder if that would be sufficient to bring the code up to date?...

Posted by: Matthew Weymar at May 24, 2005 04:50 AM