date/time missing from inverse geotagging output

Started by tobloyd, December 13, 2014, 08:01:08 PM

Previous topic - Next topic

tobloyd

Hi everyone & many thanks in advance!

I am trying to create a gpx track from a directory of geotagged images.

I am following the Inverse Geotagging procedure described here: http://www.exiftool.org/geotag.html#GPX

The Problem: the generated output contains no date/time info.

Here is an example output:
<trkpt lat="21.000000" lon="-157.000000">
  <ele>60</ele>
</trkpt>

Here is what I need instead:
<trkpt lat="21.000000" lon="-157.000000"><ele>-23</ele><time>2014-05-26T09:46:52Z</time></trkpt>

Am I missinig something obvious about the tool?

Cheers

Phil Harvey

If you look at the gpx.fmt file, you will see that it uses GPSDateTime for the timestamp.  This is a Composite tag that is derived from GPSDateStamp and GPSTimeStamp.  It must be that one or other of these is missing from your images.  You can change GPSDateTime to any other available timestamp, but it may not be synchronized with the GPS, and you may have to specify another timezone (other than "Z") in the -d format string.

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

tobloyd

Wow Phil, I am amazed that you personally replied--and so quickly. I'm very impressed! Where's the donation link  :)

Following are the images' metadata fields. Since they're made by a Garmin device, I assume they contain the necessary time information, but I could be wrong.

EXIF Data
   File name:   VIRB0017.JPG
   File size:   2886377 bytes (4608x2592, 1.9bpp, 12x)
   EXIF Summary:   1/11s f/2.0
Camera-Specific Properties:
   Equipment Make:   Garmin
   Camera Model:   VIRB
   Camera Software:   VIRB
   Maximum Lens Aperture:   f/3.6
   Sensing Method:   One-Chip Color Area
Image-Specific Properties:
   Image Orientation:   Top, Left-Hand
   Horizontal Resolution:   96 dpi
   Vertical Resolution:   96 dpi
   Image Created:   2014:12:12 14:21:10
   Exposure Time:   1481089/16777216 sec
   F-Number:   f/2.0
   Exposure Program:   Aperture Priority
   ISO Speed Rating:   0
   Lens Aperture:   f/2.0
   Exposure Bias:   0 EV
   Metering Mode:   Pattern
   Light Source:   Unknown
   Flash:   No Flash
   Color Space Information:   sRGB
   Image Width:   4608
   Image Height:   2592
   Exposure Index:   1
   Exposure Mode:   Auto
   White Balance:   Auto
   Latitude:   N 21° 00' 0.00
   Longitude:   W 157° 00' 00.00
   Altitude:   4294967295.00 m
Other Properties:
   Resolution Unit:   i
   Chrominance Comp Positioning:   Co-Sited
   Exif IFD Pointer:   250
   Compression Scheme:   JPEG Compression (Thumbnail)
   Image Orientation:   Top, Left-Hand
   Horizontal Resolution:   1 dpi
   Vertical Resolution:   1 dpi
   Resolution Unit:   i
   Offset to JPEG SOI:   1516
   Bytes of JPEG Data:   4500
   Exif Version:   2.10
   Image Generated:   2014:12:12 14:21:10
   Image Digitized:   2014:12:12 14:21:10
   Meaning of Each Comp:   Unknown
   Image Compression Mode:   1.8
   Shutter Speed:   1/11 sec
   File Source:   Digital Still Camera
   Scene Type:   Directly Photographed
   Latitude Reference:   N
   Longitude Reference:   W
   Altitude Reference:   0
   GPS Speed Reference:   mph
   GPS Image Direction Ref:   True North

Using the "Image Created" timestamp should be close enough for my needs, I imagine, but how would I modify the gpx.fmt file to pull from that instead?

Perhaps I'm actually going about solving my main problem in the wrong way altogether: I have two cameras mounted 180° opposite to create a "Streetview" like sequence. Both cameras are taking photos at 2 second intervals. The Garmin geotags the images, but the GoPro does not. I am trying to tag the GoPro images based on the Garmin ones. And there are too many thousands of images to do this manually.

I am trying to accomplish this by through inverse geotagging the Garmin photos & then using the gpx file to tag the GoPro photos. Is there by chance a more elegant solution?

Thank you tremendously again--I will go find your donate button as soon as I click "post"!

Phil Harvey

I got the donation, thanks!

I think your strategy to geotag the GoPro images is reasonable.  This is what I would do.

It would be more useful to me if you gave the output of "exiftool -G1 -a -s" instead of what you posted.

But to answer your question, simply change the "GPSDateTime" in gpx.fmt to whatever tag name you want from the exiftool command above (I added -s to show tag names instead of descriptions).  Then change the "Z" in the -d format string of the command to create the GPX file to whatever time zone corresponds to the tag you chose.  For example, for the timezone -05:00, the command would look like this:

exiftool -p gpx.fmt -d %Y-%m-%dT%H:%M:%S-05:00 DIR > out.gpx


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

tobloyd

Thanks again!

I altered it to populate timestamps from the "FileModifyDate" field. The time *is* included now, the XML looks good, but for some reason all my apps read the out.gpx time as 04:23:45 instead of 14:23:45 even though the timestamp states it correctly. Is one of the meta url's telling it to try to read 12 hr time or something?

<?xml version="1.0" encoding="utf-8"?>
<gpx version="1.0"
creator="ExifTool 9.77"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<trk>
<number>1</number>
<trkseg>
<trkpt lat="21.000000" lon="-157.000000"><ele>60</ele><time>2014-12-12T14:23:45-10:00</time></trkpt>
</trkseg>
</trk>
</gpx>

Phil Harvey

They read it out as 04:23 because they are converting to UTC (14:23 - 10:00 = 04:23 UTC).

- Phil

Edit:  Hmmm. Wait.  My math above was correct, but I should have added 10 hours, and not subracted.  (Because a time zone of -10:00 is already behind UTC by 10 hours.)  So 14:23 converted from the -10:00 time zone to UTC is 00:23 the next day.  So I don't understand after all.  I do find time zones confusing.
...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 ($).

tobloyd

OK, I finally got it (by stopping myself from trying to figure the time zones out anymore)

I changed the argument back to "Z" instead of "-10", and then changed my GoPro images to GMT. Location accuracy is all I need for my project, so this a perfectly acceptable solution. Thank you so much for all of your help--this is a very powerful tool you've created!

To anyone that stumbles on this thread in a similar situation as me:

I adjusted the gpx.fmt from:
#[BODY]  <time>$gpsdatetime</time>

To this:
#[BODY]  <time>$DateTimeOriginal</time>

And I ran:
exiftool -p gpx.fmt -d %Y-%m-%dT%H:%M:%SZ "PATH TO IMAGE FOLDER" > out.gpx

Then I set the image time on my non-geotagged images to GMT and used the generated out.gpx file to geotag them.

Phil Harvey

This is certainly a blunt-edged solution that will work.  It would have been nice to figure out the time zones though.  I was suspicious that your other software interpreted the time zones improperly, but you said "all my apps", so I wouldn't expect this to happen to more than one.  What apps are you talking about?

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