Geotagging of photos has become usual thing: it is supported by many web-services, applications, cheap digital cameras has built-in GPS receivers. But usually only geographic coordinates are used. But exif has many other useful fields: target coordinates, shooting direction (only horizontal, vertical direction is not supported), speed and movement direction. For me, the most interesting one is shooting direction (target coordinates are interesting too, but not this time) so I decided to add it's support to gallery2.
Support in gallery2
There is a good module map
for gallery, which shows photos on map. But I didn't like two things:
- Lack of shooting direction support
- Usage of GoogleMaps
First issue has been solved by modification of map module. You can see the result here
. You can get the same features by applying attached to this thread patch. Following features are added:
- Reading of direction from tags
- Field of view calculation (for a limited number of cameras)
- Displaying of this stuff with KML
I haven't need to create production level code. My intention was to beautifully show photos on this site. So some limitations do have place:
- Direction is read from EXIF only, there is no possibility to set it from interface.
- FOW is calculated correctly only for canon 40D, canon 400D and full frame 35mm cameras. EXIF doesn't contain information about sensor size, which is needed for FOW calculation. So I have to use an array of sensor sizef of different cameras. You can add your model by editing map/classes/FOWCalculator.class.
- Direction to magnetic north is not recalculated to direction to real north.
Instead of GoogleMaps, used by default, I decided to use free and more advanced OpenLayers toolkit. It has been an easy task because I'm using drupal and Mapping Kit module. So I just added KML layer produced by map module to the OpenLayers map. By the way, built-in map doesn't show shooting direction appropriately, OpenLayers doesn't have such problem.
- Photo preparation
To make all this work you need to fill in appropriate EXIF fields. I didn't hear about cameras with built-in digital compass, so it seems, that you would have to set direction manually. I determine it by my eyes with a help of map and set it with exiftool:
Bill Gates fans can try searching for GUI applications, which do the same thing. I definitely have seen some.
exiftool -GPSImgDirectionRef=T -GPSImgDirection=220 -GPSLatitude=55.64959 -GPSLongitude=37.97509 IMG_9315.jpg