Can't write (minus) decimal degrees to -GPSLatitute or -GPSLongitude ?

Started by letterman, November 03, 2018, 07:39:17 PM

Previous topic - Next topic

letterman


(Windows command line, latest exiftool)

Minus sign is always dropped (without warning) when writing decimal degree (South) latitudes or (west) longitudes?

exiftool -GPSLatitude=-10.95 -GPSLongitude=-63.85  file.jpg

(or exiftool -GPSLatitude="-10.95" -GPSLongitude="-63.85"  file.jpg  etc.) 

exittool  -GPSLatitude= -GPSLongitude file.jpg

GPS Latitude                    : 10 deg 57' 0.00" N
GPS Longitude                   : 63 deg 51' 0.00" E

There must be a way to do this (since signed decimal degrees are the only rational way to use/represent coordinates since about 1900.  ;-) 

Thanks!

Phil Harvey

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

letterman

Thanks, but doesn't work for me:

exiftool -P -xmp:gpslatitude=-10.95 -xmp:gpslongitude=-63.85 file.jpg
    1 image files updated

also with ( ="-10.95" )

exiftool -gpslatitude -gpslongitude file.jpg
GPS Latitude                    : 10 deg 57' 0.00" N
GPS Longitude                   : 63 deg 51' 0.00" E


Ok, I see I need to specify XMP for reading too:   

exiftool -xmp:gpslatitude -xmp:gpslongitude  file.jpg
GPS Latitude                    : 10 deg 57' 0.00" S
GPS Longitude                   : 63 deg 51' 0.00" W


Any way to consolidate the different latitude and longitude values?

Phil Harvey

I don't know what you mean by consolidate.  When reading or writing?  Add -a -G to see duplicates and the metadata type when reading, and drop the group name when writing to write both at the same time (if they both exist).

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

StarGeek

Are you using the same file in the second post as you used in the first?  If so, you're now writing to two different tags. 

In the first post, you wrote to the GPS tags in the EXIF block.  But as per the second paragraph of FAQ #14
     For EXIF GPS coordinates, the reference direction is specified separately with the EXIF:GPSLatitudeRef or EXIF:GPSLongitudeRef tag.
So you need to write to GPSLatitudeRef and GPSLongitudeRef as well as GPSLatitude and GPSLongitude.  Take note that this is only needed for the EXIF gps tags. 

In the second post, you instead wrote to the XMP GPS tags.  These tags can include the negative numbers and do not need the Ref set.  But they also have lower priority in exiftool and are rarely used in any other programs.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

letterman


Thanks, by "consolidate" I mean set all the GPS latitude and longitude values using signed decimal degrees.

i.e. I can set XMP:GPSLatitude using signed decimal degrees - so can I now use that value to set the GPSLatitude?   (Apparently not.)

exiftool -P   -GPSLatitude=xmp:gpslatitude -GPSLongitude=xmp:gpslongitude file.jpg
Warning: Error converting value for GPS:GPSLatitude (ValueConvInv)
Warning: Error converting value for GPS:GPSLongitude (ValueConvInv)
Nothing to do.

I guess I don't get exif in general - I don't see how it makes sense to allow different values for different tag names unless they're supposed
to mean different things...   ;-)       

exiftool -a -G -gpslatitude -gpslongitude   file.jpg
[EXIF]          GPS Latitude                    : 10 deg 57' 0.00"
[XMP]           GPS Latitude                    : 10 deg 57' 0.00" S
[Composite]     GPS Latitude                    : 10 deg 57' 0.00" N
[EXIF]          GPS Longitude                   : 63 deg 51' 0.00"
[XMP]           GPS Longitude                   : 63 deg 51' 0.00" W
[Composite]     GPS Longitude                   : 63 deg 51' 0.00" E

And if the "-GPSLatitude=-33.3"  isn't a legit value for the tag (sign is dropped before writing),
shouldn't there be a "Warning: Error converting value for GPS:GPSLatitude" like when trying to copy from XMP:GPSLatitude with -GPSLatitude=xmp:gpslatitude ?

Thanks for the helps!

Phil Harvey

It is unfortunate that the EXIF and the XMP definitions are different formats, but it doesn't make sense to change the name because of this.  There are Composite tags that allow signed values to be extracted for both EXIF and XMP, but when writing EXIF you must also remember to write the reference direction tags.  If you want to copy XMP to EXIF GPS or visa versa, there are argument files in the full distribution to help with this (also available here and here).

- Phil

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

StarGeek

Quote from: letterman on November 03, 2018, 09:44:56 PM
i.e. I can set XMP:GPSLatitude using signed decimal degrees - so can I now use that value to set the GPSLatitude?   (Apparently not.)

exiftool -P   -GPSLatitude=xmp:gpslatitude -GPSLongitude=xmp:gpslongitude file.jpg
Yes, you can.  But this command is making Common Mistake #5c.  Additionally, you still have to set the appropriate Ref tags.

exiftool -P  "-GPSLatitude<xmp:gpslatitude" "-GPSLatitudeRef<xmp:gpslatitude" "-GPSLongitude<xmp:gpslongitude" "-GPSLongitudeRef<xmp:gpslongitude" file.jpg

Alternatively, you can download the xmp2gps.args file and use that.
exiftool -@ xmp2gps.args file.jpg

QuoteI guess I don't get exif in general - I don't see how it makes sense to allow different values for different tag names unless they're supposed
to mean different things...   ;-)



"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype