Astronomy photographer of the year has been open for a couple of months now, and the astrophoto Flickr group has a few hundred photos now. The amazing astrometry.net bot has been scanning the group and about 70 photos have been tagged with their celestial coordinates, using
astro: machine tags.
Flickr is one of the data sources available for use in YQL. Here’s a YQL query to grab the astro: tags for a photo if you know its Flickr id.
select tags.tag.raw from flickr.photos.info where photo_id='3330304396' and tags.tag.raw like 'astro:%'
The Google Earth plugin allows you to display an interactive map of the night sky on a web page and supports the Google Earth API too. Have a look at barnabu.co.uk for some great examples, including a planetarium. Since the YQL query above returns tags containing the celestial coordinates of a flickr photo, those coordinates can be passed to the Google Earth plugin to display the same area of the night sky. Here’s an example for the Horsehead Nebula in Orion. View the source code to see how the astronomical coordinates are parsed from the YQL data and sent to the plugin.
That’s good if we know the id of a single photo. What if we want to display all the photos from the astrophoto group that are tagged with
astro:RA (the celestial equivalent of
geo:long)? The YQL query to grab the photo details and
astro: tags for multiple photos is more involved, using a join to get the photo ids, but still quite straightforward.
select farm, server, id, secret, title, urls.url.content, tags.tag.raw from flickr.photos.info where (tags.tag.raw like 'astro:%') and photo_id in ( select id from flickr.photos.search(30) where group_id='973956@N23' and machine_tags='astro:RA=' )
Finally, if we know exactly which photos we want to use in our gallery, we can replace the inner select with a list of id numbers.
select farm, server, id, secret, title, urls.url.content, tags.tag.raw from flickr.photos.info where (tags.tag.raw like 'astro:%') and photo_id in ( 2955988513, 2970415185, 2796500688 )
If you want to find out more about the machine tags that we’re using in the astrophoto group, I wrote a brief introduction for developers on the Royal Observatory web site.