1#------------------------------------------------------------------------------ 2# File: gpx.fmt 3# 4# Description: Example ExifTool print format file to generate a GPX track log 5# 6# Usage: exiftool -p gpx.fmt -ee FILE [...] > out.gpx 7# 8# Requires: ExifTool version 10.49 or later 9# 10# Revisions: 2010/02/05 - P. Harvey created 11# 2018/01/04 - PH Added IF to be sure position exists 12# 2018/01/06 - PH Use DateFmt function instead of -d option 13# 2019/10/24 - PH Preserve sub-seconds in GPSDateTime value 14# 15# Notes: 1) Input file(s) must contain GPSLatitude and GPSLongitude. 16# 2) The -ee option is to extract the full track from video files. 17# 3) The -fileOrder option may be used to control the order of the 18# generated track points when processing multiple files. 19#------------------------------------------------------------------------------ 20#[HEAD]<?xml version="1.0" encoding="utf-8"?> 21#[HEAD]<gpx version="1.0" 22#[HEAD] creator="ExifTool $ExifToolVersion" 23#[HEAD] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 24#[HEAD] xmlns="http://www.topografix.com/GPX/1/0" 25#[HEAD] xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd"> 26#[HEAD]<trk> 27#[HEAD]<number>1</number> 28#[HEAD]<trkseg> 29#[IF] $gpslatitude $gpslongitude 30#[BODY]<trkpt lat="$gpslatitude#" lon="$gpslongitude#"> 31#[BODY] <ele>$gpsaltitude#</ele> 32#[BODY] <time>${gpsdatetime#;my ($ss)=/\.\d+/g;DateFmt("%Y-%m-%dT%H:%M:%SZ");s/Z/${ss}Z/ if $ss}</time> 33#[BODY]</trkpt> 34#[TAIL]</trkseg> 35#[TAIL]</trk> 36#[TAIL]</gpx> 37