1

I have a GPS file containing data such as

<trkpt lat="56.9359839838" lon="-4.4651045874">
    <ele>30.42</ele>
    <time>2021-03-30T20:09:56Z</time>
</trkpt> 

I can then use exiftool on the cmd line (windows based machine) to do the following exiftool -xmp:gpslongitude=-4.4651045874 -xmp:gpslatitude=56.9359839838 -GPSAltitude=30.42 DSC00320_b.JPG

Note that this does not work - exiftool -exif:gpslongitude=-4.4651045874 -exif:gpslatitude=56.9359839838 -GPSAltitude=30.42 DSC00320_a.JPG This drops the negative from the longitude and puts the GPS tag in the wrong position (as if the value was +ve)

After doing the xmp based command and I load the file into say Flickr it will put it's location in the exact same spot as if the longitude value was positive! So after checking another tool (GeoSetter) which has a map preview, it loads the same image and put it in the correct position?

So Flickr gets it wrong, but GeoSetter gets it right from the exact same image.

After digging around I find this is the reason.

enter image description here

If I use GeoSetter to set the time zone then upload to Flickr it now puts it in the correct position.

So simply put how do I set the time zone for GPS data? I've tried the following commands and a range of others which all fail.

"-gpstimestamp<${createdate}-00:00"
"-GPSTimeStamp<${DateTimeOriginal}" -n
-Geotime<DateTimeOriginal# -n
"-gpsdatestamp<${DateTimeOriginal}"

Finally if I do a visual comparison of data from the same file with valid timezone data (right) and one without (left) the addition of "Date/Time Digitized" stands out as being added, so I'm guessing this is why that file works. (there are also a considerable amount of other changes to the metadata after doing the timezone add via GeoSetter, I don't think relevant to this Q, but if requested I can add more details) enter image description here


Update of info for anyone interested since great answer below. This image shows the difference in the metadata between the working file (left) and the file that doesn't work everywhere (note Flickr gets it wrong) on the right. You can see both files contain the correct data, but the working file contains all the correct data inside the same group, while the other has it spread into different groups. image showing diff in metadata

3

I can't explain what is happening exactly with Flickr but I can help fix some of the details with the problem.

You cannot set a timezone for the GPS time stamps (GPS:GPSDateStamp and GPS:GPSTimeStamp) because the GPS time stamps are required to be in UTC. It will always be +00:00.

The reason why your example GPS command fails is because the GPS coordinates are split into six separate tags, one each to hold the absolute value for each coordinate (GPSLatitude/GPSLongitude/GPSAltitude) and one each to hold the reference direction (GPSLatitudeRef/GPSLongitudeRef/GPSAltitudeRef with N/S/E/W/Above/Below). You need to set both to get the accurate gps coordinate. Luckily, with exiftool you can use a wildcard to set both at the same time
exiftool -GPSLatitude*=56.9359839838 -GPSLongitude*=-4.4651045874 -GPSAltitude*=30.42 DSC00320_a.JPG

Note that this only applies to the GPS coordinates that appear in the EXIF block (which exiftool groups under the GPS group). The GPS tags in the XMP-exif group do include the reference direction in the same tag, but not all programs can read these tags.

There may be additional details missing from your exiftool output because you are not showing group names and the possibly duplicate tag names. You should always use the command in ExifTool FAQ #3 to get all possible information from the file in order to make accurate before/after comparisons

2
  • Brilliant answer! I've edited my Q as I can't add an image into a comment if you are interested in seeing the metadata diff. Looks like the essential diff was the 'incorrect' file added all the appropriate data into different groups, yet your working command placed them all into the same group.
    – delp
    Apr 4 at 8:32
  • 1
    The Composite group data can be ignored as that is data that exiftool creates derived from other tags. It doesn't actually exist in the file in that form. For example, the Composite GPS tags are made combining the number tag and the reference direction rather than having to combine the data yourself. This so the data is more easily accessible and readable.
    – StarGeek
    Apr 4 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.