Error when trying to add GPSAltitudeRef to an NEF file.

Started by Archive, May 12, 2010, 08:53:51 AM

Previous topic - Next topic

Archive

[Originally posted by brett on 2005-10-07 02:33:49-07]

I've successfully added GPSLatitude,GPSLatitudeRef,GPSLongitude,GPSLongitudeRef and GPSAltitude to my NEF image, but when it comes to adding GPSAltitudeRef, I get the following error:

C:\Image-ExifTool-5.64>perl exiftool -GPSAltitudeRef=0 c:\temp\dsc_1706.nef

Can't convert GPS:GPSAltitudeRef (not in PrintConv)

    0 image files updated

    1 image files unchanged

Any idea what's happening here?

Archive

[Originally posted by exiftool on 2005-10-07 13:04:38-07]

You aren't the first one to ask this question.

If you consult the GPS tag documentation https://exiftool.org/TagNames/GPS.html, you will see a list of print conversion values for the GPSAltitudeRef:

Code:
   0 = Above Sea Level
    1 = Below Sea Level

So a value of "0" is printed as "Above Sea Level", and "1" is printed as "Below Sea Level".  Reading and writing with ExifTool is symmetrical, so a value that is printed as "Above Sea Level" must also be written in that form.  (ie. The inverse print conversion is applied when writing values.)  For example, to write GPSAltitudeRef you can type:

Code:
   exiftool -gpsaltituderef='Above Sea Level' image.jpg

or any unambiguous short form may be used, and ExifTool will figure out what you mean.  ie)

Code:
   exiftool -gpsaltituderef=above image.jpg

Alternatively, the print conversion can be disabled with the "-n" option.  In this case the printed value of GPSAltitudeRef will be "0" or "1", and the value is written in the same way.  (I am assuming this is what you were trying to do, but without the "-n" option.)  So the command below has exactly the same effect as the above commands:

Code:
   exiftool -n -gpsaltituderef=0 image.jpg

I hope this makes sense.  I will add this to the FAQ.

Archive

[Originally posted by exiftool on 2005-10-07 14:11:42-07]

I should also explain why you didn't have any problems with GPSLatitudeRef and GPSLongitudeRef even though these tags have similar print conversions:

Code:
GPSLatitudeRef:
    'N' = North
    'S' = South
GPSLongitudeRef:
    'E' = East
    'W' = West

For these tags, the unconverted value just happens to the the first letter in the converted value.  So, for example, if you type:

Code:
   exiftool -gpslatituderef=n image.jpg

ExifTool looks at the 'n' you entered, compares it to 'North' and 'South', and decides that you must have meant 'North'.  Then the 'North' is converted back to 'N' through the inverse print conversion before being written to file.  So in this case the command will work even if you incorrectly enter the unconverted value.

Possibly a bit confusing, but it should all make sense once you understand how ExifTool converts tag values.

Archive

[Originally posted by brett on 2005-10-11 05:42:40-07]

Thanks, now I follow.