Adding Flickr photos to Foursquare using YQL

Foursquare

Image by miss604 via Flickr

Browsing the updated Foursquare development documents I came across a real nice hidden gem: it appears that the Flickr folks have enabled so called machine tags to associate a photo with a Foursquare venue.

The almost hidden quote from the Flickr Developer blog:

This is the part where I casually mention that we’ve also added machine tags extra love for Four Square venues IDs. I’m just saying…

Now how cool would it be to display a little photo on my Foursquare Layar venue detail pages?
Remembering @codepo8‘s execellent talk at the Fronteers conference last week, I realized that this is where the really cool YQL engine comes in really handy.

And indeed, the following query does it all:

select * from flickr.photos.search
    where machine_tags="foursquare:venue=132009"
    limit 1

Just save the REST command url, wrap it in a little PHP handler and we’re good to go (homework for next time: process the YQL response in XML format with js/e4x and skip the PHP part altogether).

So now you will see a little thumbnail picture for every venue which has a photo tagged on Flickr. There aren’t many yet, but hey, it’s a start!

See it in action in the Foursquare Layar app on your phone (iPhone, Android) or read my announcement for more background information about the foursquare layar app.

Reblog this post [with Zemanta]