Quote from: Uwe on September 07, 2023, 05:22:35 PMThis is the result:
XMP-exif:GPSAltitude=2162.97823458283 m
Exif:GPSAltitude=2162.978235 m
I have not found this altitude in any place in the GPX file(attached). The GPX file was created by Garmin Oregon 600.
Exiftool doesn't use the closest track point to the time given in the image. From the Geotagging with ExifTool page (https://exiftool.org/geotag.html)
QuoteThe GPS track log file is loaded, and linear interpolation is used to determine the GPS position at the time of the image
So unless the image was taken exactly at the same time as one of the time stamps in the track, it's going to be an approximate altitude based upon the track point before and after that time stamp.
QuoteMy questions: why are metadata written with different precision
GPS coordinates, latitude and longitude as well as altitude, are not saved as decimal numbers in image files as they are in the GPX file. In the case of
GPSLatitude/
GPSLongitude, they are saved as three fractions (degrees, minutes, seconds) while
GPSAltitude is saved as a single fraction. And because of this, some rounding will occur.
So when you look at the actual values that are stored in the file using the
-v3 (
-verbose3) option (https://exiftool.org/exiftool_pod.html#v-NUM--verbose), you can see the following data, using GPS coordinates of 40.6892, -74.0445, 2162.9782345828294
| | 1) GPSLatitudeRef = N
| | - Tag 0x0001 (2 bytes, string[2]):
| | 007c: 4e 00 [N.]
| | 2) GPSLatitude = 40 41 21.12 (40/1 41/1 528/25)
| | - Tag 0x0002 (24 bytes, rational64u[3]):
| | 00c0: 00 00 00 28 00 00 00 01 00 00 00 29 00 00 00 01 [...(.......)....]
| | 00d0: 00 00 02 10 00 00 00 19 [........]
| | 3) GPSLongitudeRef = W
| | - Tag 0x0003 (2 bytes, string[2]):
| | 0094: 57 00 [W.]
| | 4) GPSLongitude = 74 2 40.2 (74/1 2/1 201/5)
| | - Tag 0x0004 (24 bytes, rational64u[3]):
| | 00d8: 00 00 00 4a 00 00 00 01 00 00 00 02 00 00 00 01 [...J............]
| | 00e8: 00 00 00 c9 00 00 00 05 [........]
| | 5) GPSAltitudeRef = 0
| | - Tag 0x0005 (1 bytes, int8u[1]):
| | 00ac: 00 [.]
| | 6) GPSAltitude = 2162.978235 (1788783/827)
| | - Tag 0x0006 (8 bytes, rational64u[1]):
| | 00f0: 00 1b 4b 6f 00 00 03 3b [..Ko...;]
As you can see, the
GPSLatitude is saved as "40/1 41/1 528/25", the
GPSLongitude is "74/1 2/1 201/5", and the
GPSAltitudeis "1788783/827"
Quoteis it possible to set the number of decimal places/rounding when writing the GPS Altitude metadata ?
Using the
-GeoTag option, I'm not sure. You can try using the
-c (
-coordFormat) option (https://exiftool.org/exiftool_pod.html#c-FMT--coordFormat) to see if that works. Editing one of the examples given there, you could try
-c "%.6f" to see if you get 6 degrees of precision. But of course, that still might end up with longer numbers depending upon what the actual fractions end up as.