ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: busywait on August 14, 2017, 12:37:47 PM

Title: Error in GPS Track Log web help page?
Post by: busywait on August 14, 2017, 12:37:47 PM
Hello,

I think that there is a problem with one of the GPS examples on line at https://exiftool.org/geotag.html (https://exiftool.org/geotag.html)

That page shows example gpx.fmt file containing

#[BODY]<trkpt lat="$gpslatitude#" lon="$gpslongitude#">
#[BODY]  <ele>$gpsaltitude#</ele>
#[BODY]  <time>$gpsdatetime</time>
#[BODY]</trkpt>


I am using the command line from that page on Windows using exiftool version 10.6.0.
exiftool -fileOrder gpsdatetime -p gpx.fmt -d %Y-%m-%dT%H:%M:%SZ /Users/Phil/Pictures > out.gpx

That produces an output file that contains this fragment:

<trkpt lat="52.6907463055556" lon="-4.04787252777778">
  <ele>64</ele>
  <time>m-H:SZ</time>
</trkpt>


Note that the time element above is not a time.

If I add an additional # character at the end of $gpsdatetime# in the template, as below, then I get the output that I expect.

#[BODY]<trkpt lat="$gpslatitude#" lon="$gpslongitude#">
#[BODY]  <ele>$gpsaltitude#</ele>
#[BODY]  <time>$gpsdatetime#</time>
#[BODY]</trkpt>


The correct output:

<trkpt lat="52.6907463055556" lon="-4.04787252777778">
  <ele>64</ele>
  <time>2017:08:03 09:37:11Z</time>
</trkpt>


Is this a typo in the example online, or a problem with the way that I am trying to use exiftool?
Title: Re: Error in GPS Track Log web help page?
Post by: Phil Harvey on August 14, 2017, 01:19:51 PM
The problem is that you need to double the "%" characters if you are running the command from a Windows .BAT file

- Phil
Title: Re: Error in GPS Track Log web help page?
Post by: busywait on August 14, 2017, 04:08:15 PM
Quote from: Phil Harvey on August 14, 2017, 01:19:51 PM
The problem is that you need to double the "%" characters if you are running the command from a Windows .BAT file

Which actually means I need *8* %s before each format specifier in this line of my batch file:

@set "action_params=-if "$gpslongitude ge 0" -fileOrder DateTimeOriginal -p "%runner_dir%_gps_gpx.fmt" -d %%%%%%%%Y-%%%%%%%%m-%%%%%%%%dT%%%%%%%%H:%%%%%%%%M:%%%%%%%%SZ -@ %runner_dir%_gps_gpx.txt"


But wow, that worked! Thanks :)
Title: Re: Error in GPS Track Log web help page?
Post by: busywait on August 14, 2017, 05:11:04 PM
I've worked out how to get the -d option in to my ARGFILE (_gps_gpx.txt in the command line above). When I first tried it, it didn't work - I've worked out that trailing spaces were my problem.
Title: Re: Error in GPS Track Log web help page?
Post by: Phil Harvey on August 15, 2017, 07:36:47 AM
Quote from: busywait on August 14, 2017, 04:08:15 PM
Which actually means I need *8* %s before each format specifier in this line of my batch file:

@set "action_params=-if "$gpslongitude ge 0" -fileOrder DateTimeOriginal -p "%runner_dir%_gps_gpx.fmt" -d %%%%%%%%Y-%%%%%%%%m-%%%%%%%%dT%%%%%%%%H:%%%%%%%%M:%%%%%%%%SZ -@ %runner_dir%_gps_gpx.txt"

Ouch!  If you had wanted a literal "%" in the date string, then you would have needed 16 %'s in your string (which happens often when setting file names from date/time values -- eg. to pass through the ExifTool formatting codes like %e).  That would be 4 levels of escapement.  Ridiculous.

- Phil