Cannot get the example of creating a GPX file to work

Started by mulcamd, February 03, 2011, 04:44:03 PM

Previous topic - Next topic

mulcamd

Hi,

On page http://www.exiftool.org/geotag.html is the example "The -if option may be added to ensure that only files containing GPS information are processed. For example, the following command creates "out.gpx" ...

The command is exiftool -r -if '$gpsdatetime' -fileOrder gpsdatetime -p gpx.fmt -d %Y-%m-%dT%H:%M:%SZ pics > out.gpx
Since I have my GPS info in the EXIF I changed the $gpsdatetime' into $gpstimestamp. Further I used " because I am on Windows.

I copied the gpx.fmt file and only changed again the gpsdatetime' into gpstimestamp.
#------------------------------------------------------------------------------
# File:         gpx.fmt
#
# Description:  Example ExifTool print format file for generating GPX track log
#
# Usage:        exiftool -p gpx.fmt -d %Y-%m-%dT%H:%M:%SZ FILE [...] > out.gpx
#
# Revisions:    2010/02/05 - P. Harvey created
#
# Notes:     1) All input files must contain GPSLatitude and GPSLongitude.
#            2) The -fileOrder option may be used to control the order of the
#               generated track points.
#------------------------------------------------------------------------------
#[HEAD]<?xml version="1.0" encoding="utf-8"?>
#[HEAD]<gpx version="1.0"
#[HEAD] creator="ExifTool $ExifToolVersion"
#[HEAD] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
#[HEAD] xmlns="http://www.topografix.com/GPX/1/0"
#[HEAD] xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
#[HEAD]<trk>
#[HEAD]<number>1</number>
#[HEAD]<trkseg>
#[BODY]<trkpt lat="$gpslatitude#" lon="$gpslongitude#">
#[BODY]  <ele>$gpsaltitude#</ele>
#[BODY]  <time>$gpstimestamp</time>
#[BODY]</trkpt>
#[TAIL]</trkseg>
#[TAIL]</trk>
#[TAIL]</gpx>


The batch file I use is:
dir "D:\Temp\Lightroom Burned Exports" > out.txt
exiftool -r -if "$gpstimestamp" -fileOrder gpstimestamp -p gpx.fmt -d "%Y-%m-%dT%H:%M:%SZ" "D:\Temp\Lightroom Burned Exports" > out.gpx
exiftool -r -gpslatitude -gpstimestamp "D:\Temp\Lightroom Burned Exports" >> out.txt


This is the out.gpx file:
======== D:/Temp/Lightroom Burned Exports/DAH_20110120_0022.jpg
======== D:/Temp/Lightroom Burned Exports/DAH_20110120_0023.jpg
======== D:/Temp/Lightroom Burned Exports/DAH_20110131_0184.jpg
    1 directories scanned
    5 files failed condition
    3 image files read


So I gues that 3 files do contain the GPS information.

The out.txt file contains:
De volumenaam van station D is Data
Het volumenummer is 1C3D-9219

Map van D:\Temp\Lightroom Burned Exports

03-02-2011  21:49    <DIR>          .
03-02-2011  21:49    <DIR>          ..
03-02-2011  18:27         1.018.482 DAH_20110101_9738.jpg
03-02-2011  18:27           803.718 DAH_20110101_9739.jpg
03-01-2011  09:03         3.365.596 DAH_20110101_9740.JPG
03-01-2011  09:03         3.287.225 DAH_20110101_9741.JPG
03-02-2011  18:27         1.733.569 DAH_20110120_0022.jpg
03-02-2011  18:27         1.716.887 DAH_20110120_0023.jpg
01-02-2011  21:00           943.951 DAH_20110131_0184.jpg
               7 bestand(en)       12.869.428 bytes
               2 map(pen)  72.653.033.472 bytes beschikbaar
======== D:/Temp/Lightroom Burned Exports/DAH_20110101_9738.jpg
GPS Latitude                    : 41 deg 18' 40.64" N
======== D:/Temp/Lightroom Burned Exports/DAH_20110101_9739.jpg
GPS Latitude                    : 41 deg 18' 40.64" N
======== D:/Temp/Lightroom Burned Exports/DAH_20110101_9740.JPG
======== D:/Temp/Lightroom Burned Exports/DAH_20110101_9741.JPG
======== D:/Temp/Lightroom Burned Exports/DAH_20110120_0022.jpg
GPS Latitude                    : 41 deg 18' 31.60" N
GPS Time Stamp                  : 13:12:27
======== D:/Temp/Lightroom Burned Exports/DAH_20110120_0023.jpg
GPS Latitude                    : 41 deg 18' 31.60" N
GPS Time Stamp                  : 13:12:27
======== D:/Temp/Lightroom Burned Exports/DAH_20110131_0184.jpg
GPS Latitude                    : 41 deg 13' 44.65" N
GPS Time Stamp                  : 09:56:27
    1 directories scanned
    7 image files read


Why do I not get a meaningful out.gpx. At least I would think that of the last 3 files all the information is there????

Phil Harvey

I suspect you are using a really old version of ExifTool (before the improved -p option was introduced), because I can't see how this could possibly happen with a recent version.  The current version is 8.48, but version 8.10 or later should work.

Also, using GPSTimeStamp is problematic, and most certainly won't work if the positions span more than one day.  GPSDateTime is derived from GPSTimeStamp and GPSDateStamp to avoid this problem, so you should use it instead if it is available (ie. if GPSDateStamp exists in your images).

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