ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: grovesr on July 20, 2021, 11:14:16 AM

Title: Geotagging with GPX format file fails with whitespace in <time> element
Post by: grovesr on July 20, 2021, 11:14:16 AM
I am using a Garmin RV760 GPS device GPX log to extract track information to be used to geotag a directory of image files. All works fine if I use the log file exactly as it is contained on the Garmin device.

My goal is to extract the track information for a single day to a separate file, then use that much smaller file to geotag the picture files. I also archive the single day GPX file with the pictures as a record.

I am using Python BeautifulSoup4 to extract the day's track information and then printing out that track to a new smaller GPX file. Everything seems to work fine. I am able to import that new GPX file into a Google map. When I attempt to geotag with that new file however, exiftool finds no track points. error message: Loaded 0 points from XML-format GPS track log file 'extracted_track_2_seg.gpx'

I tracked this down to exiftool failing to import GPX track points when the <time></time> element contains any whitespace. I get this whitespace when pretty printing the GPX XML data from BeautifulSoup4. If I remove the whitespace in the time element, the import works. All other elements, other than the <time></time> element can tolerate whitespace and still be successfully imported.

I have attached working and non-working GPX format files with a single trkpnt in them, the only difference being the whitespace in the <time></time> element. I use the following command to check for success or failure in a directory where there are no image files:
exiftool -v -geotag filename.gpx .

Thanks for this excellent tool!

Regards,
Rob
Title: Re: Geotagging with GPX format file fails with whitespace in <time> element
Post by: Phil Harvey on July 20, 2021, 05:38:43 PM
Hi Rob,

It is not clear to me that this is valid GPX.  The white space is part of the value, and shouldn't be there.

Unfortunately I'm using a simplified XML processor for GPX, and patching it to accept whitespace like this will be painful.  But I'll look into it.

- Phil
Title: Re: Geotagging with GPX format file fails with whitespace in <time> element
Post by: grovesr on July 20, 2021, 05:51:02 PM
Hi Phil,
No Worries. I have patched my own code to remove the white spaces. I just thought you might want to be aware of the issue in case you wanted to make the import a little more robust.

Regards,
Rob