ExifTool Forum

ExifTool => Newbies => Topic started by: willm on December 06, 2017, 07:34:00 PM

Title: Assign Signed value to unsigned GPS altitude
Post by: willm on December 06, 2017, 07:34:00 PM
Long time listener first time caller...

I am trying to assign a relative altitude value (XMP-drone-dji:RelativeAltitude (real)) to the GPS altitude value (GPS:GPSAltitude(rational64u))

The DJI relative altitude is signed (e.g: +39.6), and the GPS Altitude is unsigned (e.g. 50 m).

When I try to write the relative altitude to gps altitude as below:

exiftool -n -GPS:GPSAltitude=XMP-drone-dji:AbsoluteAltitude dir

I get an error:

Warning: Error converting value for GPS:GPSAltitude (ValueConvInv)
Nothing to do.


Is there a protocol to convert signed to unsigned?

Title: Re: Assign Signed value to unsigned GPS altitude
Post by: Phil Harvey on December 06, 2017, 07:56:11 PM
Welcome willm,

The problem is you need to use "<" instead of "=" when copying the value of another tag.  "=" is for assigning a literal value.  This is common mistake 5c (https://exiftool.org/mistakes.html#M5).

- Phil
Title: Re: Assign Signed value to unsigned GPS altitude
Post by: willm on December 07, 2017, 01:22:23 PM
Thanks Phil! I knew it would be something silly but could just not figure it out. Working great now, thanks for the fantastic tool!
Title: Re: Assign Signed value to unsigned GPS altitude
Post by: julianpatterer on February 10, 2021, 06:31:56 PM
Thank you very much for the solution, how can I make it add the "+" sign as well?

-exiftool -n -XMP-drone-dji:AbsoluteAltitude<GPS:GPSAltitude -dir
Title: Re: Assign Signed value to unsigned GPS altitude
Post by: Phil Harvey on February 10, 2021, 08:41:41 PM
Like this?:

exiftool -n "-XMP-drone-dji:AbsoluteAltitude<+$GPS:GPSAltitude" DIR

- Phil