Convert GPSDATETIME from YYYY-mm-dd to YYYY:mm:dd

Started by davidcpreston, March 29, 2023, 11:10:53 AM

Previous topic - Next topic

davidcpreston

I've looked at lots of info but can't find an easy answer to this, but probably just my lack of knowledge.
The standard GPX output form Outdooractive and CSV from GPS Logger use "-" instead of ":" in the date.
I have tried adding the -d option in the exiftool -geotag command, but it errors so I guess it's not that simple?
I replaced them in the CSV file and ran it and it works, but I obviously don't want to do that.

StarGeek

Quote from: davidcpreston on March 29, 2023, 11:10:53 AMThe standard GPX output form Outdooractive and CSV from GPS Logger use "-" instead of ":" in the date.

This is how the date in a GPX is supposed to be formatted
example:
<trkpt lat="32.707996" lon="-117.161255">
<ele>18</ele>
<time>2013-03-09T21:03:46.000Z</time>
</trkpt>

What is the exact command and exact output of the problem you are running into?
"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

davidcpreston

exiftool -geotag 20230325-093200.txt DSC01308.JPG
Warning: No track points found in GPS file '20230325-093200.txt' in File:Geotag (ValueConvInv)
Warning: GPS track is empty in File:Geotime (ValueConvInv) - DSC01308.JPG
Warning: No writable tags set from DSC01308.JPG
    0 image files updated
    1 image files unchanged

SO, I tried exiftool -d "%Y-%m-%d %H:%M:%S" -geotag 20230325-093200.txt DSC01308.JPG
That does nothing, so I suspect it is more involved than this?

StarGeek

What is the format of your "20230325-093200.txt" file?  Is it an actual GPX track?  Can you share a few lines?

"No track points found" is usually either an unsupported format or no time stamps in the file (see Geotag Troubleshooting #1).  "No writable tags set" is almost always the fact that image date/times are local but GPS date/times are UTC, so there's a difference of the time zone (see Geotag Troubleshooting #2).

Add the -v2 (-verbose2) option to your command.  There should be a line for "GPS track start"/"GPS track end".  Then for each file, there will be a "Geotime value" line with the date/time from the file adjusted to UTC. If the latter doesn't fall within the range of the first two, then it's a timing issue.  If any of these are missing, it's a problem of the input data

Example output from -v2
Loaded 1 points from CSV-format GPS track log file 'test.csv'
  GPS track start: 2023:03:16 18:00:00.000 UTC
  GPS track end:   2023:03:16 18:00:00.000 UTC
Writing File:Geotag
======== y:/!temp/Test4.jpg
Setting new values from y:/!temp/Test4.jpg
  Geotime value:   2023:03:16 18:00:00.000 UTC (local timezone is -07:00)
"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

davidcpreston

#4
Apologies for not being clearer, I was pointing out that I had tried it with a log file from GPS Logger and gpx file from Outdooractive. The example I gave is for the text file, and as I say if I replace the 2023-03-25 with 2023:03:25 it works, but I hoped I wouldn't have to. That said I still have to replace the headings.

type,GPSDateTime,GPSLatitude,GPSLongitude,accuracy(m),GPSAltitude,geoid_height(m),speed(m/s),bearing(deg),sat_used,sat_inview,name,desc
T,2023-03-25 09:32:00,54.97310496,-2.10098168,4.99,25.339,51.215,0.000,,15,28,20230325-093200,GPS Logger: 20230325-093200
T,2023-03-25 09:32:30,54.97311597,-2.10094277,4.97,33.923,51.215,0.000,,19,28,,
T,2023-03-25 09:32:33,54.97310424,-2.10091600,4.49,35.079,51.215,0.550,126,20,28,,
T,2023-03-25 09:32:45,54.97299137,-2.10094156,9.87,39.379,51.215,1.350,184,23,27,,
T,2023-03-25 09:32:54,54.97288911,-2.10092891,7.49,34.900,51.215,1.360,173,13,29,,
T,2023-03-25 09:33:03,54.97278240,-2.10097785,4.47,40.843,51.215,1.400,226,21,29,,
T,2023-03-25 09:33:12,54.97269525,-2.10092843,11.79,38.145,51.215,1.080,149,11,27,,

Phil Harvey

The current version of ExifTool (12.59) reads the track points from this file:

> cat a.txt
type,GPSDateTime,GPSLatitude,GPSLongitude,accuracy(m),GPSAltitude,geoid_height(m),speed(m/s),bearing(deg),sat_used,sat_inview,name,desc
T,2023-03-25 09:32:00,54.97310496,-2.10098168,4.99,25.339,51.215,0.000,,15,28,20230325-093200,GPS Logger: 20230325-093200
T,2023-03-25 09:32:30,54.97311597,-2.10094277,4.97,33.923,51.215,0.000,,19,28,,
T,2023-03-25 09:32:33,54.97310424,-2.10091600,4.49,35.079,51.215,0.550,126,20,28,,
> exiftool a.jpg -geotag a.txt -v3
Argument "-Geotime<DateTimeOriginal#" is assumed
CSV column 'type' ignored
CSV column 'DateTime' is datetime
CSV column 'Latitude' is lat
CSV column 'Longitude' is lon
CSV column 'accuracy(m)' ignored
CSV column 'Altitude' is alt
CSV column 'geoid_height(m)' ignored
CSV column 'speed(m/s)' ignored
CSV column 'bearing(deg)' ignored
CSV column 'sat_used' ignored
CSV column 'sat_inview' ignored
CSV column 'name' ignored
CSV column 'desc' ignored
Loaded 3 points from CSV-format GPS track log file 'a.txt'
  GPS track start: 2023:03:25 09:32:00.000 UTC
  GPS track end:   2023:03:25 09:32:33.000 UTC
Writing File:Geotag
======== a.jpg
Setting new values from a.jpg
...

You need ExifTool version 12.43 or later to read the date/time values with dashes:

July 6, 2022 - Version 12.43
  - Tolerate dashes instead of colons as date separators in -geotag CSV files


- 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 ($).

davidcpreston

Oops, mine is 12.40. Apologies, I should have checked that first

Phil Harvey

But I notice that your CSV includes speed/bearing information that ExifTool currently isn't recognizing.  I'll add support for this in 12.60.

- 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: Phil Harvey on March 29, 2023, 12:13:33 PMYou need ExifTool version 12.43 or later to read the date/time values with dashes:

July 6, 2022 - Version 12.43
  - Tolerate dashes instead of colons as date separators in -geotag CSV files


Ah, that explains why it worked properly for me
"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

davidcpreston

The text file comes from the Android GPS Logger app. I want it as the GPS on my camera is working intermittently, and many high end cameras don't have a GPS receiver!
If I'm walking a new route I use Outdooractive, and I save it as gpx, BUT it uses twice as much battery as GPS Logger so I use that for know routes.
Great work guys; I shall contribute