Create composite tag from XMP:GPSLatitude and XMP:GPSLongitude tags

Started by Fulco, January 29, 2017, 11:32:04 AM

Previous topic - Next topic

Fulco

Is it possible to make a composite tag derived from the XMP:GPSLatitude and XMP:GPSLongitude tags? I tried to create from these tags a composite tag with the same formatting as you can see in the QuickTime:GPSCoordinates tag value. I looked into the documentation about this, but I couldn't figure out how to work this out. I used the config file below, but it doesn't print the XMP:GPSLongitude behind the XMP:GPSLatitude tag. Can somebody point me in the right direction?

MacBook-Air-van-Fulco:~ Fulco$ exiftool -config /Users/Fulco/Pictures/Test/XMP_GPSPosition.config -GPScoordinates -GPSPosition -c %+.10f -a -G1 -s /Users/Fulco/Pictures/Test/20160320101924.mov
[QuickTime]     GPSCoordinates                  : +52.3503440000, +4.9326850000, 0 m Above Sea Level
[QuickTime]     GPSCoordinates                  : +52.3503440000, +4.9326850000, 0 m Above Sea Level
[Composite]     GPSPosition                     : 52.350344



%Image::ExifTool::UserDefined = (
   'Image::ExifTool::Composite' => {
       GPSPosition => {
           Require => {0 => 'XMP-exif:GPSLatitude',1 => 'XMP-exif:GPSLongitude'},
           PrintConv => 'sprintf($val[0], $val[1])',
       },
   },
);


- Fulco

Hayo Baan

Your call to sprintf is incorrect. Either provide the formatting info as first argument (e.g. "%f, %f"), or ditch sprintf altogether and just return the concatenation of the two strings e.g. like so: PrintConv => '"$val[0], $val[1]"'.

        GPSPosition => {
            Require => {0 => 'XMP-exif:GPSLatitude',1 => 'XMP-exif:GPSLongitude'},
            PrintConv => 'sprintf("%f, %f", $val[0], $val[1])',
        },

or
        GPSPosition => {
            Require => {0 => 'XMP-exif:GPSLatitude',1 => 'XMP-exif:GPSLongitude'},
            PrintConv => '"$val[0], $val[1]"',
        },


However, in this case the best solution might be to just make use of the GPS formatting option -C (e.g. -C "%f"); this will print the coordinates as floating point numbers using the already present GPSPosition tag :)
Hayo Baan – Photography
Web: www.hayobaan.nl

Fulco

 That does what I want. Thank you very much Hayo!

iMac-van-Fulco:~ Fulco$ exiftool -config /usr/local/bin/GPSPositionXMP.config -a -G1 -s -c "%+.10f" -QuickTime:GPSCoordinates -GPSPositionXMP /Users/Fulco/Pictures/20160108161650.mov
[QuickTime]     GPSCoordinates                  : +52.3565640000, +4.9599410000, 0 m Above Sea Level
[QuickTime]     GPSCoordinates                  : +52.3565640000, +4.9599410000, 0 m Above Sea Level
[Composite]     GPSPositionXMP                  : +52.3565640000, +4.9599410000



%Image::ExifTool::UserDefined = (
   'Image::ExifTool::Composite' => {
       GPSPositionXMP => {
            Require => {0 => 'XMP-exif:GPSLatitude',1 => 'XMP-exif:GPSLongitude'},
            PrintConv => 'sprintf("%+.10f, %+.10f", $val[0], $val[1])',
        },
   },
);