Calculation GPSImgDirection from FlightYawDegree possible?

Started by Schmidtze, November 24, 2021, 02:20:56 PM

Previous topic - Next topic

Schmidtze

Hi,

I have a drone DJI Mini 2 now, which produces images containing data in "drone-dji:FlightYawDegree". To make it compatible with other applications, I want to copy these values to GPSImgDirection by using

exiftool "-GPSImgDirection<FlightYawDegree" -GPSImgDirectionRef=M

This works for positive values, but dji:FlightYawDegree may also be negative and GPSImgDirection only wants to get positive values. So it has to be calculated like "360-dji:FlightYawDegree" if it is negative.

Is this possible with ExifTool, to do this calculation?

Many thanks in advance and best regards
Friedemann

Phil Harvey

Hi Friedemann,

I think you want to add 360 instead of subtract from 360 if the yaw is negative.  You can do it like this:

exiftool "-GPSImgDirection<${FlightYawDegree;$_+=360 if $_ < 0}" -GPSImgDirectionRef=M FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Schmidtze

Hi Phil,

thank you so much, this works as expected! :) Of course you are right, it has to be added  ::)

Do you have a hint, how to do it only if FlightYawDegree exists and GPSImgDirection doesn't exist already? Maybe I will find out for myself...

Best regards
Friedemann

Schmidtze

QuoteDo you have a hint, how to do it only if FlightYawDegree exists and GPSImgDirection doesn't exist already?

There are enough examples on your website  :)

Schmidtze

This seems to work:

exiftool "-GPSImgDirection<${FlightYawDegree;$_+=360 if $_ < 0}" -GPSImgDirectionRef=M -if "$FlightYawDegree" -if "not $GPSImgDirection" FILE

So, many thanks again!

Friedemann

Phil Harvey

Hi Friedemann,

Great.  The only very minor thing to think about is that a GPSImgDirection of exactly "0" will be overwritten (because "0" is false).  So you should do this:

-if "not defined $GPSImgDirection"

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).