After using this method for a while, I became annoyed with Wolfram alpha, because it was so very picky about what you have to enter, and I found no way to just get the azimuth and nothing else. So I opted to write a little python script which reads out the relevant EXIF tags from an image with the pyexiv2 module (GPS Date, GPS Time, GPS Longitude and GPS Latitude) and calculates the sun's position using the pysolar module. The script gives the azimuth in degrees clockwise off north, as required by the orientation dialog in 360cities, who host my full spherical panoramas. Interested? Download the script from here:
http://bazaar.launchpad.net/~kfj/+junk/script/download/head:/sun_position-20140120072527-vlz6gee23xhwlkrl-1/sun_positionand put it into /usr/local/bin or somewhere else in your path.
You'll obviously have to have the pyexiv2 module and pysolar installed; I got pyexiv2 via my package management (I'm on Kubuntu 12.04). pysolar can be had from
http://pysolar.org/usage is simple, just pass the image's filename to the scipt and it outputs the azimuth and altitude:
$ sun_position IMG_5458.CR2
azimuth (clockwise, N = 0 degrees): 204.558020 altitude 57.709008
I hope this works generally - I geotag my images from gpx tracks, using exiftool -geotag, so the images have these GPS-related tags (printed with exiftool):
GPS Version ID : 2.3.0.0
GPS Latitude Ref : North
GPS Longitude Ref : East
GPS Altitude Ref : Above Sea Level
GPS Time Stamp : 12:25:07
GPS Date Stamp : 2013:08:09
GPS Altitude : 1022.8 m Above Sea Level
GPS Date/Time : 2013:08:09 12:25:07Z
GPS Latitude : 46 deg 1' 30.64" N
GPS Longitude : 8 deg 25' 49.52" E
GPS Position : 46 deg 1' 30.64" N, 8 deg 25' 49.52" E
In 360cities, I put the sun into the center in the orientation window, then click on the button in the top right corner and drag the tip of the compass until the number shown is equal to the azimuth.
Again this made me wish there was something like an 'absolute' control point type in hugin, where you can just enter an azimuth and an altitude value (call it yaw and pitch if you like) to set the orientation of the panorama. Then it would be as easy as 'click on the sun and set an absolute control point'. Add the nadir in the same way, and the panorama is perfectly oriented and levelled.
Kay