Read GPX/Track file w/o photos?

Started by Viktor Nemeth, July 02, 2024, 02:16:03 AM

Previous topic - Next topic

Viktor Nemeth

Hi,

Is there a way to extract location points from a gpx (track, whichever formats are supported) file without stamping them onto photos? (like parse a track file and output a kvp-list of sorts that looks something like: order, coordinates -> 1. <trkpt lat="61.491322" lon="28.437435">; 2. <trkpt lat="61.491127" lon="28.437679">
etc [the precise formatting isn't really relevant at this stage]
The data could be saved "somewhere" (again, I'd guess a txt export or csv export)
ET supports a wide range of track file formats so it'd a bit easier than relying on external tools for a more restricted (literally) GPX-only extraction method.
Thanks

v.

FrankB

On Windows try: exiftool -v4 -geotag <GPX or other LOG FILE> NUL

-v4 is needed to give you lat/lon points.
NUL will take care that nothing gets written.

I use it in ExifToolGui to display a track on the map.

Edit: Data is only output when there is a timestamp. Logical when you think about the intented use. But if you have a GPS track consisting of only lat/lon values nothing is written. It fooled me once or twice.

Sample output:
    yyyy:mm:dd hh:mm:ss.msec UTC - alt=nn lat=nn.nnnnnnnnnn lon=nn.nnnnnnnnnn
    yyyy:mm:dd hh:mm:ss.msec UTC - alt=nn lat=nn.nnnnnnnnnn lon=nn.nnnnnnnnnn
    yyyy:mm:dd hh:mm:ss.msec UTC - alt=nn lat=nn.nnnnnnnnnn lon=nn.nnnnnnnnnn
    yyyy:mm:dd hh:mm:ss.msec UTC - alt=nn lat=nn.nnnnnnnnnn lon=nn.nnnnnnnnnn
  GPS track end:   yyyy:mm:dd hh:mm:ss.msec UTC
Writing File:Geotag
======== NUL
Setting new values from NUL
Warning: File is empty - NUL
Warning: No writable tags set from NUL
Nothing changed in NUL
    0 image files updated
    1 image files unchanged

StarGeek

For a GPX track, exiftool can read it directly and it will list the data. You will get output like this
[XMP]           GpxVersion                      : 1.1
[XMP]           GpxCreator                      : Yamatabi logger for Android
[XMP]           GpxXmlns                        : http://www.topografix.com/GPX/1/0
[XMP]           GpxTrkName                      : 2013:03:09 13:03:46
[XMP]           GpxTrkTrksegTrkptLat            : 32.707996
[XMP]           GpxTrkTrksegTrkptLon            : -117.161255
[XMP]           GpxTrkTrksegTrkptEle            : 18
[XMP]           GpxTrkTrksegTrkptTime           : 2013:03:09 21:03:46.000Z
[XMP]           GpxTrkTrksegTrkptLat            : 32.70796
[XMP]           GpxTrkTrksegTrkptLon            : -117.16112
[XMP]           GpxTrkTrksegTrkptEle            : 4
[XMP]           GpxTrkTrksegTrkptTime           : 2013:03:09 21:03:56.000Z
[XMP]           GpxTrkTrksegTrkptLat            : 32.707775
[XMP]           GpxTrkTrksegTrkptLon            : -117.16104
[XMP]           GpxTrkTrksegTrkptEle            : 78

Some other types would have similar output.  The main trouble would be that they would have different tag names.

But some of the supported track types, such as CSV, wouldn't work in this way.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

FrankB

Quote from: StarGeek on July 02, 2024, 08:55:42 AMFor a GPX track, exiftool can read it directly and it will list the data. You will get output like this
 of the supported track types, such as CSV, wouldn't work in this way.

Correct. But I had to add -a, or only the first tag would be written.
Also, if you have GPX files with lots (100.000+) of points, I think it works slower.

Viktor Nemeth

hi both,

thanks for the replies, I'll play around with the suggestions. :)

Viktor Nemeth

One more question, this might be a "no" but any way to separate the data by trkseg blocks?
eg somehow indicate that
        <trkseg><!-- TZ: 10800 -->
            <trkpt lat="61.492302" lon="28.434484">
                <ele>106.10135021906005</ele>
                <time>2023-07-21T12:49:16Z</time>
            </trkpt>
            <trkpt lat="61.492302" lon="28.434484">
                <ele>106.10135021906005</ele>
                <time>2023-07-21T12:49:47Z</time>
            </trkpt>
        </trkseg>
        <trkseg><!-- TZ: 10800 -->
            <trkpt lat="60.171028" lon="25.062719">
                <ele>37.678538187806225</ele>
                <time>2023-08-18T13:43:48Z</time>
            </trkpt>
        </trkseg>

...are two different groups?

FrankB

I dont think so. Not with the exiftool -v4 -geotag <GPX or other LOG FILE> NUL  method.

A few remarks:

- trkseg has no tag that you can use as an ID. Like for example 'name'. How would you relate the trkseg with the group name?
- trkseg is only valid for GPX files (I think) If it would work for GPX how would it work for other supported log files?
- The option I can think of is to split the GPX before running ExifTool.

Phil Harvey

Correct.  ExifTool ignores the "trkseg" grouping.

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

Viktor Nemeth